query on a date that I enter

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

Guest

I have created a query that shows information that is current as of today's
date. However, I would like to be able to enter a date prior to today.

query is currently set as: Date()
how do I alter this so that I can enter a date of my choosing?
 
Change the query so that it reads

[Enter Date]

When your query runs, it will prompt you for a date.
 
I've tried this but it is not working. The current date (I would prefer to
enter my own date) is used to calculate the number of weeks between two
dates. ie how many weeks between the borrow date and return date
([return date]-[borrow date]/7)
This calculation works if I use the current date as the return date, but
shows an error when I attempt to [enter the date].

Any ideas?

David Ferguson said:
Change the query so that it reads

[Enter Date]

When your query runs, it will prompt you for a date.


tobacey said:
I have created a query that shows information that is current as of today's
date. However, I would like to be able to enter a date prior to today.

query is currently set as: Date()
how do I alter this so that I can enter a date of my choosing?
 
Where?

Without a better idea where in your query you are trying to do this, it'll
be tough diagnosing. The one hint you provided is that you want to enter a
date. But does this mean you are selecting, based on a date entered, or
using that date entered as part of a calculation, or ...?

Please post your SQL statement.
 
Access may not be understanding that you are entering a date. You can fix this
by declaring your parameter or by forcing the parameter to be cast to the proper
type in the where clause.

Try
(DateValue([Enter Return Date])-[Borrow Date])/7
or
(CDate([Enter Return Date])-[Borrow Date])/7
Although you might be better off using the DateDiff function in your query.
I've tried this but it is not working. The current date (I would prefer to
enter my own date) is used to calculate the number of weeks between two
dates. ie how many weeks between the borrow date and return date
([return date]-[borrow date]/7)
This calculation works if I use the current date as the return date, but
shows an error when I attempt to [enter the date].

Any ideas?

David Ferguson said:
Change the query so that it reads

[Enter Date]

When your query runs, it will prompt you for a date.


tobacey said:
I have created a query that shows information that is current as of today's
date. However, I would like to be able to enter a date prior to today.

query is currently set as: Date()
how do I alter this so that I can enter a date of my choosing?
 
Back
Top