Delimit dates - how?

  • Thread starter Thread starter LL
  • Start date Start date
L

LL

I have a form with a combo box that contains a list of dates. Selecting a
date triggers an event procedure. As part of this procedure, I want to
compare the date from the text box with a date from records in a recordset.

My problem is that I don't understand the correct syntax for doing this. I
know that I have to enclose a date within ## within VBA but I don't know how
to do this when referencing the date on the form:

if rstRecordset!CompletionDate >= # [Forms].[Form1].[Combo4] # then
do something
end

I can get it to work if I add the date 'by hand':

if rstRecordset!CompletionDate >= #4/1/2010# then
do something
end

Also, how do I change the form date to US format?

Any help would be greatly appreciated.

LL
 
if rstRecordset!CompletionDate >= Format([Forms].[Form1].[Combo4],
"\#yyyy\-mm\-dd\#") then
 
Back
Top