Thanks Jerry. I'm a little confused as to where to put the code. What I
want to happen is to have the user enter a date in a text box on a form
like
02/01/2007 and hit an ok button. Once they hit the okay button I want to
format the date to look like this 107032 and then call a query I've
designed
and use the text box on the form with the new format as my date criteria.
I
know how to call an object on a form in a query but I'm confused by where
to
put your code and what the debug.print is all about. Can you clarify for
me
please?
I think what Jerry was assuming you would do is use the expression in
an expression in the query. Try typing
"1" & Right(Year([Forms]![yourform]![datefield]),2) & String(3 -
Len(Datepart("y",[Forms]![yourform]![datefield])),"0") &
DatePart("y",[Forms]![yourform]![datefield])
or a bit more simply
"1" & Format([Forms]![yourform]![datefield],"yy") &
Format(DatePart("y", [Forms]![yourform]![datefield]), "000")
on the Criteria line on your query.
John W. Vinson [MVP]