Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenForm Wherecondition trouble - Date datatype 1

Status
Not open for further replies.

criseyde

Programmer
Oct 1, 2001
3
US
Greetings,

I'm trying to use the DoCmd.OpenForm function to open a form to the record with the following matching criteria (fname (text datatype); lname(text datatype); and date (date/time datatype)).

I am using the string:

stLinkCriteria = "[fname]=""" & Me![fname] & """" & _
" AND [lname]=""" & Me![lname] & """" & _
" AND [pdate]= " & Me![pdate]

In the command:

DoCmd.OpenForm stDocName, , , stLinkCriteria

in my Where condition. It doesn't work. It opens the form but there are no matching records (though there should be). The function works when the PDATE is not part of the Where condition.

EXAMPLE OF WORKING CONDITION:

stLinkCriteria = "[fname]=""" & Me![fname] & """" & _
" AND [lname]=""" & Me![lname] & """"


Is there something about the Date/Time datatype that is making this not work? Does anyone have any idea about what I'm doing wrong?

Thanks for your help,

Criseyde
 
You could try this, "#" specifies a date criteria:

stLinkCriteria = "[fname]=""" & Me![fname] & """" & _
" AND [lname]=""" & Me![lname] & """" & _
" AND [pdate]= #" & Me![pdate] & "#"
 
Thank you for your help. The query works perfectly now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top