Results 1 to 13 of 13
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Using a date from a form in a query (2002)

    Hi!

    I have a query that will has various forumla's based on dates. The date that determines which formula to apply is entered int txtStartDate on frmGenerateInvoices. The user enters the date I.E. 10/1/2005 into the form. The query contains a field RearStoreActiveDate and the SQL is as follows: RearStoreActiveDate: [forms]![frmGenerateInvoices]![txtstartdate]. Unfortunatley it comes up blank when the query is run and does not show the date that is on the form. What am I missing?

    Thanks!

    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    Have you made sure that the form frmGenerateInvoices is open, and that the user has actually entered something in the text box txtStartDate and confirmed the entry by tabbing to or clicking in another control?

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a date from a form in a query (2002)

    Hi,

    Yes, I'm testing it now as this is a new addition to the form. I have the date entered and have tabbed off of the box multiple times but the query comes up blank.

    Leesha

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    Do you mean that the entire query comes up blank?

  5. #5
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a date from a form in a query (2002)

    OH God no! The rest of the query is fine. The date is the only field that is blank - its not picking up the date from the form.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    I'm afraid I can't tell what is happening without seeing the database. Could you post a stripped down copy? See <post#=401925>post 401925</post#> for instructions.

  7. #7
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a date from a form in a query (2002)

    Here you go.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    Try this:

    RearStoreActiveDate: CDate([forms]![frmGenerateInvoices]![txtstartdate])

  9. #9
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a date from a form in a query (2002)

    That worked beautifully. Now my question is what is cdate and why did that make it work?

    Thanks,
    Leesha

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    CDate converts a value (usually a string) to a Date/Time value. Without the CDate conversion, the query doesn't interpret the value of the text box correctly, I'm not sure why.

  11. #11
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a date from a form in a query (2002)

    Thanks for the info!

  12. #12
    Lounger
    Join Date
    Jun 2002
    Location
    Michigan City, Indiana, USA
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a date from a form in a query (2002)

    Hans!!! You are my hero!

    I was having the exact same problem, found this post, tried it and it worked beautifully!!!! I just thought you should know that someone was shouting "I love you, Hans!" to their monitor. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    Have an awesome day!

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a date from a form in a query (2002)

    Thanks! It's nice to hear that a thread from a year ago is still useful.

Posting Permissions

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