Record Set with between dates

G

Guest

Hi everybody
I want to write record set which will extract all the Invoices from table
Invoice where DVNo is equal to the DVNo on the form and date is between the 2
dates from the Startup form, I dont have date field on my form where I'm
searching the Invoice Nos. my record set is some how like this please correct
this:

Set rst = db.OpenRecordset("SELECT InvoiceNo,Date FROM Invoices WHERE
[StoreIssueNo]= &StoreIssueNo& and Date Between [forms]![Startup Dialog
Form]!#[BeginningDate]# and [Forms]![Startup Dialog Form]!#[EndingDate]#")

Thanks
 
N

Naresh Nichani MVP

Hi:

Try this --

Set rst = db.OpenRecordset("SELECT InvoiceNo,Date FROM Invoices WHERE
[StoreIssueNo]= " & StoreIssueNo & " and Date Between #" &
[forms]![Startup Dialog
Form]![BeginningDate] & "# and #" & [Forms]![Startup Dialog
Form]![EndingDate] & "#")

The variables should be outside the quotes and you should concatenate the
string with &.

Regards,

Naresh Nichani
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top