Question on Code

G

Guest

I have this code currently in a text field
Me.Filter = "[tblGrantCompletion.theMonth] = '" & Me.Combo87 & "'"
Me.FilterOn = True
However I would like it to be for a Date/Time field. Is there anything in
this code that says its for text or would I be okay pasting this for a
date/time field. I do have to change my field names though.
Thanks
Chey
 
J

Jeff Boyce

Chey

If you are using a Date/Time data type field, you'll need to use the
Date/Time delimiter instead (use the # symbol, not the quote, on either
side).

Are you quite confident that the field is correctly typed as Date/Time?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

oh well of course not. In my table I have it as Date/Time. This comes out
of 2 tables. They both are date Time. I also have it formated as mmmm yyyy
so it looks like May 2006. That is how I want it. I just want to make sure
that I am not typing a text code into a date field.
Thanks

Jeff Boyce said:
Chey

If you are using a Date/Time data type field, you'll need to use the
Date/Time delimiter instead (use the # symbol, not the quote, on either
side).

Are you quite confident that the field is correctly typed as Date/Time?

Regards

Jeff Boyce
Microsoft Office/Access MVP


Chey said:
I have this code currently in a text field
Me.Filter = "[tblGrantCompletion.theMonth] = '" & Me.Combo87 & "'"
Me.FilterOn = True
However I would like it to be for a Date/Time field. Is there anything in
this code that says its for text or would I be okay pasting this for a
date/time field. I do have to change my field names though.
Thanks
Chey
 
G

Guest

So I changed the quotes to # but I don't think I did all the right ones.
This is what I did.
Me.Filter = #[TheMonth2] = '" & Me.Combo163 & "'#
Me.FilterOn = True
Do I need to put # everywhere there is "?

Jeff Boyce said:
Chey

If you are using a Date/Time data type field, you'll need to use the
Date/Time delimiter instead (use the # symbol, not the quote, on either
side).

Are you quite confident that the field is correctly typed as Date/Time?

Regards

Jeff Boyce
Microsoft Office/Access MVP


Chey said:
I have this code currently in a text field
Me.Filter = "[tblGrantCompletion.theMonth] = '" & Me.Combo87 & "'"
Me.FilterOn = True
However I would like it to be for a Date/Time field. Is there anything in
this code that says its for text or would I be okay pasting this for a
date/time field. I do have to change my field names though.
Thanks
Chey
 
F

fredg

So I changed the quotes to # but I don't think I did all the right ones.
This is what I did.
Me.Filter = #[TheMonth2] = '" & Me.Combo163 & "'#
Me.FilterOn = True
Do I need to put # everywhere there is "?

Jeff Boyce said:
Chey

If you are using a Date/Time data type field, you'll need to use the
Date/Time delimiter instead (use the # symbol, not the quote, on either
side).

Are you quite confident that the field is correctly typed as Date/Time?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Chey said:
I have this code currently in a text field
Me.Filter = "[tblGrantCompletion.theMonth] = '" & Me.Combo87 & "'"
Me.FilterOn = True
However I would like it to be for a Date/Time field. Is there anything in
this code that says its for text or would I be okay pasting this for a
date/time field. I do have to change my field names though.
Thanks
Chey

Me.Filter = "[TheMonth2] = #" & Me.Combo163 & "#"
Me.FilterOn = True

The above assumes [TheMonth2] contains a valid date (Month, Day,
Year), as does Combo153.
 
G

Guest

Thanks it worked

fredg said:
So I changed the quotes to # but I don't think I did all the right ones.
This is what I did.
Me.Filter = #[TheMonth2] = '" & Me.Combo163 & "'#
Me.FilterOn = True
Do I need to put # everywhere there is "?

Jeff Boyce said:
Chey

If you are using a Date/Time data type field, you'll need to use the
Date/Time delimiter instead (use the # symbol, not the quote, on either
side).

Are you quite confident that the field is correctly typed as Date/Time?

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have this code currently in a text field
Me.Filter = "[tblGrantCompletion.theMonth] = '" & Me.Combo87 & "'"
Me.FilterOn = True
However I would like it to be for a Date/Time field. Is there anything in
this code that says its for text or would I be okay pasting this for a
date/time field. I do have to change my field names though.
Thanks
Chey

Me.Filter = "[TheMonth2] = #" & Me.Combo163 & "#"
Me.FilterOn = True

The above assumes [TheMonth2] contains a valid date (Month, Day,
Year), as does Combo153.
 

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

Similar Threads

filter 10
match 2
Filtering a form with a combo box using left function 4
Filter with double-click 1
Filter on date problem 8
date problem 2
Filtering by month 1
Me.filter between 2 dates 2

Top