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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Using a date from a form in a query (2002)

    Author
    Topic
    #424829

    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

    Viewing 0 reply threads
    Author
    Replies
    • #976812

      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?

      • #976814

        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

        • #976816

          Do you mean that the entire query comes up blank?

          • #976818

            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.

            • #976820

              I’m afraid I can’t tell what is happening without seeing the database. Could you post a stripped down copy? See post 401925 for instructions.

            • #976825

              Here you go.

            • #976829

              Try this:

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

            • #976831

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

              Thanks,
              Leesha

            • #976834

              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.

            • #976836

              Thanks for the info!

            • #1035595

              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. clapping

              Have an awesome day!

            • #1035601

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

    Viewing 0 reply threads
    Reply To: Using a date from a form in a query (2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: