Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002

    Unhappy Unanswered: Using Form with TextBoxes for Query

    I am trying to generate a query (by date) by using two textboxes on a form, instead of putting something like ">[StartDate] And <[FinishDate]" in the criteria of the date field in the query.
    I have one textbox named SD, and one named FD. I want to be able to query the data by the dates between those two textboxes. Any ideas?

    BTW, I have tried to use expression builder to make an expression with the textboxes in, but it doesn't work. I must be doing something wrong.

    Thanks in advance!

  2. #2
    Join Date
    Aug 2002
    Québec, Canada
    The following SQL use a form named Form3 where there is two textboxes, txtDate1, txtDate2 containing the date the query use. The Query select statements from the table Table2 using the field TheDate and forms criteria. You must make sure the form is open (or open and invisible), when you run the query.

    SELECT Table2.TheDate
    FROM Table2
    WHERE (((Table2.TheDate)>=[Forms]![Form3]![txtDate1]) AND ((Table2.TheDate)<=[Forms]![Form3]![txtDate2]));
    If you can't make it works, post the SQL code, you may have done a typo mistake


  3. #3
    Join Date
    Aug 2002
    Thanks, that's just what I was looking for.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts