Current Date in a Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a webpage interface for a guy to enter data into a database at
the office remotely using IE. I want to create a query that will display all
the results from the data he entered so he can double check it.

What do I need to put into the date field so that it will pull only records
that were entered today. Like:

where [Date] = SysDate ? or something?
 
Larry,
If the field in your table that holds the date is named [Date], that's a
problem to begin with. Access uses the term Date to represent the current
date (system date), so your fieldname "Date" could cause problems/conflicts.
Rename the field to [EntryDate] or something else.
Then, in a query, a criteria of...
EntryDate = Date()
will yield all records entered that day.
Check out the Date function, and Date Expressions in Access Help.
 
First, don't name the field Date: that's a reserved word, and can lead to
problems. Let's call it MyDate for lack of a better name.

Assuming MyDate just contains date (as opposed to date and time), your query
can use

WHERE MyDate = Date()

If MyDate contains date and time (because, say, you used the Now function to
populate it), use

WHERE MyDate Between Date() And Date() + 1
 
One note - If your EntryDate field has a time component then you need to do
it different to remove the time else it will not pull any records except for
those entered at mignight. There are several ways.
Int([EntryDate]) = Date()

Al Camp said:
Larry,
If the field in your table that holds the date is named [Date], that's a
problem to begin with. Access uses the term Date to represent the current
date (system date), so your fieldname "Date" could cause problems/conflicts.
Rename the field to [EntryDate] or something else.
Then, in a query, a criteria of...
EntryDate = Date()
will yield all records entered that day.
Check out the Date function, and Date Expressions in Access Help.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Larry G. said:
I have created a webpage interface for a guy to enter data into a database
at
the office remotely using IE. I want to create a query that will display
all
the results from the data he entered so he can double check it.

What do I need to put into the date field so that it will pull only
records
that were entered today. Like:

where [Date] = SysDate ? or something?
 
Since there was no mention of a Time component in Larry's post, I did not
include any comments in that regard.
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

KARL DEWEY said:
One note - If your EntryDate field has a time component then you need to
do
it different to remove the time else it will not pull any records except
for
those entered at mignight. There are several ways.
Int([EntryDate]) = Date()

Al Camp said:
Larry,
If the field in your table that holds the date is named [Date], that's
a
problem to begin with. Access uses the term Date to represent the
current
date (system date), so your fieldname "Date" could cause
problems/conflicts.
Rename the field to [EntryDate] or something else.
Then, in a query, a criteria of...
EntryDate = Date()
will yield all records entered that day.
Check out the Date function, and Date Expressions in Access Help.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Larry G. said:
I have created a webpage interface for a guy to enter data into a
database
at
the office remotely using IE. I want to create a query that will
display
all
the results from the data he entered so he can double check it.

What do I need to put into the date field so that it will pull only
records
that were entered today. Like:

where [Date] = SysDate ? or something?
 

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

Date search query 0
Dynamic SQL Pass Through Query 1
date range in a query 2
Query date Parameter Anomaly 4
Solve query? 14
Crosstab Query and Date Parameters 10
Current Month Label 2
Date Parms passed from a Form 7

Back
Top