Query Search by date - SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msamhouri
    New Member
    • Oct 2012
    • 20

    Query Search by date - SQL

    I am working in access project, so the backend of the system is SQL, I tried to build a query to retrieve the data based on the date, the date appear in different form in a text box, so when I put the date in the text box and run the query I need the query to give me the data based on the date in the Text box. I tried to put in the query as following
    Like [forms]![Main]![Text49]

    but its not working like regular Ms Access query, it keeps giving me (Your entry cannot be converted to a valid date time value), can you help me with this query please?
    This is the code for the query
    Code:
     INSERT INTO dbo.AccTDailyT
                            (No, AccountNo, AccountName, AccountName2, Balance, TransDate)
    SELECT      No, AccountNo, AccountName, AccountName2, Balance, TransDate
    FROM          dbo.Acct_DataT
    ORDER BY No
    Thank you in advance for your help
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    It's a pretty clear message, whatever date you're trying to insert isn't a real date.

    Comment

    • msamhouri
      New Member
      • Oct 2012
      • 20

      #3
      Okay, I believe in access project you need to put another formula to run this query, not like the regular ms access when you put this formula its working fine
      Like [forms]![Main]![Text49]
      and it shows you the correct data,
      But in MS Access project - SQL it doesn’t work,
      Can you please help me with what formula that I have to but in the criteria or give me the correct code??
      [IMG]C:\Documents and Settings\malsam houri\My Documents\My Pictures\untitl ed[/IMG]

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Are you talking about your other thread? You have no where criteria in the SQL you posted above.

        Also, I can't see the picture you posted. You forgot to attach it to the thread.

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3653

          #5
          Also, if you are simply looking for exact dates, there is no need for the "Like" statement. Date comparison can simpy use "=". You may need to use the date delimiter "#" concatenated around the date your are looking for, however.

          Comment

          Working...