Open Form Where Clause

Robert M

Registered User.
Local time
Today, 07:30
Joined
Jun 25, 2009
Messages
153
I have a form "Restock_frm" that I have on close do the following program.

Dim Dt As Date
Dt = Date
DoCmd.OpenForm "DataCheck_frm", , , "[Date] = Dt"
DoCmd.Close acForm, "Restock_frm"

The form DataCheck_frm is supposed to open showing only records that have today's date on them. It works, but depending on how I have the where clause written it either shows nothing, or all the records, or gives me an error.

"[Date] = Dt " asks for the parameter
("Date" = Dt) give a Type Missmatch Error
Date = Dt opens the DataCheck_frm but shows all records

What is the correct structure for the Where Clause in the OpenForm to get my form opened how I want.

Thank you for your help with this problem.

Robert M
 
Howzit

Try

Code:
DoCmd.OpenForm "DataCheck_frm", , , "[Date] =#" & Dt & "#"
 

Users who are viewing this thread

Back
Top Bottom