Setting Query Parameters Through VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StuckProgrammer
    New Member
    • Oct 2006
    • 2

    Setting Query Parameters Through VB

    Hi,
    I have 10 queries linked together via an incident number. There is a form where the user enters start and end dates to define which incident numbers are used within the queries. On running this form a query is created (UserQuery) which consequently sets the dates (as entered by the user) for all the other queries.

    I have made a new form which runs a different query but still relies on the UserQuery to set the dates. currently the user has to manually open deisgn view of UserQuery and change the date parameters before running my form. My problem is this; how can i make it so that these date parameters are changed simply by typing them in on my form? I know VB allows you to write a query within the code but i dont need a new query, i just need to change the one which already exists. Is there visual basic code to set parameters of an already-made query?

    Any help would be greatly appreciated, I've been puzzling over this for ages!

    Thanks.
  • Tanis
    New Member
    • Mar 2006
    • 143

    #2
    In the criteria of the date field in your query, refer to the form on which the user enters the dates.

    Between [forms]![frmYourFormName]![txtTextBoxName] And [forms]![frmYourFormName]![txtTextBoxName]

    Comment

    • StuckProgrammer
      New Member
      • Oct 2006
      • 2

      #3
      Tanis you're a legend, thanks.

      Comment

      Working...