Delimit dates - how?

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
 
D

Douglas J. Steele

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

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