Date saved older than 6 months

G

Guest

Hi all

I have a set of records which has a "DateSaved" field showing the date when
a record was last updated. Can anyone give me the VBA code I need to search
for records where the "DateSaved" field has a date older than 6 months (the
format is medium date dd-mmm-yy).

Thanks in anticipation of any replies

Best regards

Allan
 
G

Guest

Hi Rick

Thanks for the quick reply but neither example codes work, for both I get an
error message:

"The expression you entered contaions invalid syntax"

"You omitted an operand or operator, you entered an invalid character or
comma, or you entered text without surrounding it in quotation marks."

I copied & pasted both your examples into my query.

Can you help further

Best regards

Allan
 
R

Rick B

I just tested it on my database and it works fine. You put that in the
"Criteria" under your date field? I used the following and it worked just
fine...

<DateAdd("m",-6,Date())


You are using this under a field that is a DATE type of field, correct?
 
G

Guest

Hi Rick

Yes the field is a date field and I just tried again and got the same
message. Does it make a difference if there is an input mask?

Cheers
 
R

Rick B

In your table design view, the data type is DATE/TIME, right?

Post your query SQL here so we can see it.
 
G

Guest

Hi Rick

I'm now home from work and continuing on the database I'm building for work
and somehow now the code you gave me works, so I've no clue what was
happening before when I was in the office?

Anyhow many thanks for your input, it is most appreciated.
 

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