Run query from date input on form

  • Thread starter The Joker via AccessMonster.com
  • Start date
T

The Joker via AccessMonster.com

Hello all!

I have what I hope is a easy situation. I have a table that has information
that is entered daily with a field "Completed Date". I want to add a text
box to a form where a user can enter a date and hit a button that will run a
query for that specific completion date so I can have the query results
exported to Excel.

Would I use an unbound text box on the form? How would I set up the query to
take the date entered in the form?

Thank you very much!

- Joker
 
D

Dale Fye

Yes, an unbound textbox would be one way to do it.

Your query would look something like:

SELECT * FROM yourTable
WHERE [Completed Date] = #" & forms!formname.textboxname & "#"

You can use the Docmd.OutputTo method to export these results to Excel.
 
X

XPS350

Hello all!

I have what I hope is a easy situation.  I have a table that has information
that is entered daily with a field "Completed Date".  I want to add a text
box to a form where a user can enter a date and hit a button that will run a
query for that specific completion date so I can have the query results
exported to Excel.  

Would I use an unbound text box on the form?  How would I set up the query to
take the date entered in the form?

Thank you very much!

- Joker

In the design of the query (in the criteria section) you put something
like:
[forms]![YourForm]![SelectedDate]

You can indeed use an unbound text box. But you could also make an
unbound combox which you populate with all the unique dates from your
table. In that case you are sure to select a date that gives at least
one result.

Groeten,

Peter
http://access.xps350.com
 

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