passing input to a SQL query

B

brian

Is it possible to use a text box in a form to pass date
information to a SQL query? Here's what I'm doing.

Form1 has two fields - date1 and date2. Date1 is assigned
the value Now() and Date2 is assigned Now() +1. I run
this query daily to update a table with new info.

I would like to pass date1 and 2 into a SQL query so that
when I run the query daily, I don't have to enter the
dates each time.

Anyone have an idea?

your help is appreciated.
 
G

Guest

It is possible to pass info to a sql query. However, it
looks like you could build your sql using date functions,
and not need to pass anything from your form.
 
J

John Spencer (MVP)

Well, if it is always today's date and tomorrow's date then I wouldn't even
bother to use a form. Just use the Date function (not the Now function).

Date returns the Date; Now returns the date and TIME. When you attempt to
search for a record with a certain date and it also has the time you will run
into problems.

Without knowing your sql, I can only guess that you need something like:

Between Date() and Date() + 1

as criteria somewhere in the query.
 

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