Open form criteria

dan-cat

Registered User.
Local time
Today, 23:50
Joined
Jun 2, 2002
Messages
3,433
It's a sunny day outside but I'm stuck in here struggling with a relatively simple piece of code:

Dim Kount As Integer
Dim DKount As Date
Kount = Forms!Main!DateCount
DKount = DateAdd("d", Kount, Now() - 1)
MsgBox DKount
DoCmd.OpenForm "frmDenBookingDay", , , "DenId=Forms!Main!DenId And Date Between Now() And DKount"

All I want to do is open the form with the given date criteria.
I have managed to open a msgbox displaying the correct date, however when attempting to pass that date in the criteria of the open form command it doesn't see it.

Can anyone help?

ThankYou
 
Try this.

DoCmd.OpenForm "frmDenBookingDay", , , "DenId=" & Forms!Main!DenId & " And Date Between " & Now() & " And " & DKount
 
Sorry Tim, I'm getting a syntax error, missing operator message on that code
 
DoCmd.OpenForm "frmDenBookingDay", , , "DenId=" & Forms!Main!DenId & " And Date Between #" & Date() & "# And #" & DKount & "#"
 

Users who are viewing this thread

Back
Top Bottom