Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date Criteria in a query on a form

    Date Criteria in a query on a form


    I want to put the Criteria of a date, say >#2000-01-01# on a form,So that the user could easily change the Date Criteria on a form, without opening a query. Is it possible ?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Criteria in a query on a form

    Yes,
    Create the form and place a few controls on it - command button to close, command button to run query,text box to hold criteria value etc
    supposing the form is called frmCriteria and the text box is called txtCriteria. Set up a query to run when the command button is pressed that uses in it's criteeria row the expression frmCriteria!txtCriteria and the results should be returned accordingly
    HTH

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Date Criteria in a query on a form

    Hi,
    I get the impression from your question that you're not trying to do something quite as simple as the solution fatherjack provided - i.e. that you want to be able to include the > (or < etc.) on the form? That's not quite as easy to do and does require some code. If you're familiar with VBA then check out BuildCriteria in the help screens - I suspect your best bet is to use that in conjunction with an SQL string which you then execute.
    If that's unclear then please repost and I'll try and clarify.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Criteria in a query on a form

    Yep i agree with that, it looks like i pressed 'post it' without comparing my response and the question.
    apologies.

Posting Permissions

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