PC Review


Reply
Thread Tools Rate Thread

2 Queries, sorry, hit the enter key, ignore the other one

 
 
=?Utf-8?B?Sm9obm55IEJyaWdodA==?=
Guest
Posts: n/a
 
      8th Jun 2005
Hi there. I'm trying to find a current pay period. The following query
tells me I am missing an operator.
What am I doing wrong here?

Thanks!
-- Public Function CurrPer()
Dim bytCurrPer As Byte
Dim rs As DAO.Recordset
Dim db As DAO.Database

Set db = CurrentDb

Set rs = db.OpenRecordset("SELECT dat2005 " _
& "From tblPer05 Where dat2005 " _
& ">Date() And <Date()+7", dbOpenSnapshot)

bytCurrPer = rs("dat2005")
End Function

www.brightfuture.ca/bright
My email address can be found on my site.
 
Reply With Quote
 
 
 
 
Duane Hookom
Guest
Posts: n/a
 
      8th Jun 2005
Normally you would want to return a value from a function but yours doesn't.
Since you aren't using any variables, you could probably use a single
expression like:
=DLookup("dat2005","tblPer05","dat2005 > Date() AND dat2005 < Date()+7")

--
Duane Hookom
MS Access MVP


"Johnny Bright" <(E-Mail Removed)> wrote in message
news:C7EB3162-5893-494A-B0E9-(E-Mail Removed)...
> Hi there. I'm trying to find a current pay period. The following query
> tells me I am missing an operator.
> What am I doing wrong here?
>
> Thanks!
> -- Public Function CurrPer()
> Dim bytCurrPer As Byte
> Dim rs As DAO.Recordset
> Dim db As DAO.Database
>
> Set db = CurrentDb
>
> Set rs = db.OpenRecordset("SELECT dat2005 " _
> & "From tblPer05 Where dat2005 " _
> & ">Date() And <Date()+7", dbOpenSnapshot)
>
> bytCurrPer = rs("dat2005")
> End Function
>
> www.brightfuture.ca/bright
> My email address can be found on my site.



 
Reply With Quote
 
=?Utf-8?B?QW5kcmVhIE0=?=
Guest
Posts: n/a
 
      8th Jun 2005
Your SELECT statement needs to read:
"SELECT dat2005 From tblPer05 Where dat2005 >Date() And dat2005<Date()+7;

The 2nd dat2005 needs to be added before the <Date()+7
--
Andrea

"


 
Reply With Quote
 
Wayne Morgan
Guest
Posts: n/a
 
      8th Jun 2005
> & ">Date() And <Date()+7", dbOpenSnapshot)

While this is readable to a human, the computer insists on you specifying
both sides of the operator.

& ">Date() And dat2005<Date()+7", dbOpenSnapshot)

--
Wayne Morgan
MS Access MVP


"Johnny Bright" <(E-Mail Removed)> wrote in message
news:C7EB3162-5893-494A-B0E9-(E-Mail Removed)...
> Hi there. I'm trying to find a current pay period. The following query
> tells me I am missing an operator.
> What am I doing wrong here?
>
> Thanks!
> -- Public Function CurrPer()
> Dim bytCurrPer As Byte
> Dim rs As DAO.Recordset
> Dim db As DAO.Database
>
> Set db = CurrentDb
>
> Set rs = db.OpenRecordset("SELECT dat2005 " _
> & "From tblPer05 Where dat2005 " _
> & ">Date() And <Date()+7", dbOpenSnapshot)
>
> bytCurrPer = rs("dat2005")
> End Function
>
> www.brightfuture.ca/bright
> My email address can be found on my site.



 
Reply With Quote
 
=?Utf-8?B?Sm9obm55IEJyaWdodA==?=
Guest
Posts: n/a
 
      8th Jun 2005
Cool! That worked great! Thanks to all of you who replied to this posting.
You guys rock!
--
www.brightfuture.ca/bright
My email address can be found on my site.


"Wayne Morgan" wrote:

> > & ">Date() And <Date()+7", dbOpenSnapshot)

>
> While this is readable to a human, the computer insists on you specifying
> both sides of the operator.
>
> & ">Date() And dat2005<Date()+7", dbOpenSnapshot)
>
> --
> Wayne Morgan
> MS Access MVP
>
>
> "Johnny Bright" <(E-Mail Removed)> wrote in message
> news:C7EB3162-5893-494A-B0E9-(E-Mail Removed)...
> > Hi there. I'm trying to find a current pay period. The following query
> > tells me I am missing an operator.
> > What am I doing wrong here?
> >
> > Thanks!
> > -- Public Function CurrPer()
> > Dim bytCurrPer As Byte
> > Dim rs As DAO.Recordset
> > Dim db As DAO.Database
> >
> > Set db = CurrentDb
> >
> > Set rs = db.OpenRecordset("SELECT dat2005 " _
> > & "From tblPer05 Where dat2005 " _
> > & ">Date() And <Date()+7", dbOpenSnapshot)
> >
> > bytCurrPer = rs("dat2005")
> > End Function
> >
> > www.brightfuture.ca/bright
> > My email address can be found on my site.

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter one parameter and use it in two queries =?Utf-8?B?RGlhbmFI?= Microsoft Access 3 3rd May 2006 05:23 AM
So..All queries reg. Microsoft Tun Miniport Adapter will be ignore =?Utf-8?B?Sm9hbm5l?= Windows XP Help 3 23rd Apr 2005 04:31 AM
Need to ignore Enter key in Form Lars Netzel Microsoft ASP .NET 1 2nd Mar 2005 04:10 PM
How do I enter many queries at once in Access? =?Utf-8?B?TGl6MzAwMzg1?= Microsoft Access Queries 2 14th Oct 2004 05:36 PM
Re: DataGrid ignore enter Ken Tucker Microsoft Dot NET Framework Forms 3 29th Sep 2003 07:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:07 PM.