By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

compare a date field on form

P: n/a
I am trying to find valid records in a table
but I must compare a date field to a date stored in the table

I can see where this is wrong (ok I guess its not text)

"[date]= """ & Me.date & """"

so how do you format for a date comparison of a date field in a table
and compared to a text box with a date format?

is it something like
"[date]= """ & "#" & Me.date &"#" & """"
Oct 9 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

sparks wrote:
I am trying to find valid records in a table
but I must compare a date field to a date stored in the table

I can see where this is wrong (ok I guess its not text)

"[date]= """ & Me.date & """"

so how do you format for a date comparison of a date field in a table
and compared to a text box with a date format?

is it something like
"[date]= """ & "#" & Me.date &"#" & """"
If you remove all the quotes you should be fine.
"[SomeDate]=" & Forms![MyOpenForm]![txtDateFieldOnForm]

or you could include the # signs, but I don't think you need to
"[SomeDate]=#" & Forms![MyOpenForm]![txtDateFieldOnForm] & "#"

Oct 9 '06 #2

P: n/a
Ok I rewrote the variables and tried it without dates

but when I do something like this in code
rs.FindFirst "[Teacher] = """ & Me.TeacherName & """" & "[date]= " &
Me.date & "[formsname]= """ & Me.FormsName & """"

I get object not supported by this type of object

so I changed it to

rs.FindFirst "[Teacher] = """ & Me.TeacherName & """" & "[date]= """ &
"#" & Me.date & "#" & """" & "[formsname]= """ & Me.FormsName & """"

same error

so last but not least I tried
rs.FindFirst "[Teacher] = """ & Me.TeacherName & """" & "[Date]=#" &
Forms![formpamcriss]![date] & "#" & "[formsname]= """ & Me.FormsName &
""""
same thing again

I can't seem to get this to work no matter what

Is this the arcane way to find a match with multible criteria?
On 9 Oct 2006 15:11:50 -0700, pi********@hotmail.com wrote:
>
sparks wrote:
>I am trying to find valid records in a table
but I must compare a date field to a date stored in the table

I can see where this is wrong (ok I guess its not text)

"[date]= """ & Me.date & """"

so how do you format for a date comparison of a date field in a table
and compared to a text box with a date format?

is it something like
"[date]= """ & "#" & Me.date &"#" & """"

If you remove all the quotes you should be fine.
"[SomeDate]=" & Forms![MyOpenForm]![txtDateFieldOnForm]

or you could include the # signs, but I don't think you need to
"[SomeDate]=#" & Forms![MyOpenForm]![txtDateFieldOnForm] & "#"
Oct 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.