Now()+1

  • Thread starter Caburky via AccessMonster.com
  • Start date
C

Caburky via AccessMonster.com

Using Access 2003:
A date/time field in my query has the criteria: #3/2/2010 7:00:00 PM# Or
#3/2/2010 7:00:00 AM#. I would this query to run each morning and tried to
replace the criteria with Now()+1 rather than entering a date each time, but
I do not get any data returned. I get a message "Access not responding". Am
I asking the impossible?

Thanks!
 
M

Marshall Barton

Caburky said:
Using Access 2003:
A date/time field in my query has the criteria: #3/2/2010 7:00:00 PM# Or
#3/2/2010 7:00:00 AM#. I would this query to run each morning and tried to
replace the criteria with Now()+1 rather than entering a date each time, but
I do not get any data returned. I get a message "Access not responding".

Can't help with the not responding part (probably your db is
corrupted in some way).

For your query, Now()+1 is the time you run the query but
with tomorrow's date so I don't see how that can be useful.

If you want the criteria to be for today's date and either
7am or 7pm, try using something more like:
Date() + #7:00# OR Date() + #19:00#
 
J

Jerry Whittle

Does your criteria say Or or Between ..... And..... ? With the Or it
would only return records that have 7 am or 7 pm for that date.

Now()+1 would only return records with the exact time, down to the second,
for then next day. However even that shouldn't cause a not responding. Let's
see if your Now() function is working.

Do a Ctrl + g to bring up the VBA window.

In the Immediate window towards the bottom, put in the following then hit
enter:

Debug.Print Now()

That should give you the current date and time in the computer. If should
only take a milisecond to work. If you get an error, there may be a
references problem.
 
C

Caburky via AccessMonster.com

Marshall said:
Can't help with the not responding part (probably your db is
corrupted in some way).

For your query, Now()+1 is the time you run the query but
with tomorrow's date so I don't see how that can be useful.

If you want the criteria to be for today's date and either
7am or 7pm, try using something more like:
Date() + #7:00# OR Date() + #19:00#

Marshall,
Thank you very much this worked perfectly. I didn't realize Now() was
embedding the time I was running the query.
 
C

Caburky via AccessMonster.com

Jerry said:
Does your criteria say Or or Between ..... And..... ? With the Or it
would only return records that have 7 am or 7 pm for that date.

Now()+1 would only return records with the exact time, down to the second,
for then next day. However even that shouldn't cause a not responding. Let's
see if your Now() function is working.

Do a Ctrl + g to bring up the VBA window.

In the Immediate window towards the bottom, put in the following then hit
enter:

Debug.Print Now()

That should give you the current date and time in the computer. If should
only take a milisecond to work. If you get an error, there may be a
references problem.
Using Access 2003:
A date/time field in my query has the criteria: #3/2/2010 7:00:00 PM# Or
[quoted text clipped - 4 lines]

Jerry,
Thanks for the feedback.

I took your advice and I did have an error. My first line of defense...I
rebooted and checked current date/time and I was back in business.

I used (Date()+1)+#7:00:00 AM# Or (Date()+1)+#7:00:00 PM# and that solved my
problem.

I appreciate your response, and I will remember the error checking technique
you passed along.
 

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