Search Access dataBase by Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abdull07
    New Member
    • Oct 2007
    • 5

    #1

    Search Access dataBase by Date

    Assalam alaycom"Hello"
    Hello everybody, I have a problem in searching the database using certain date.
    The probem is how I can convert the date from textbox to be used by vb code to match dates in the database.
    I will appreciate if anyone can help. Thanks.
    Last edited by Killer42; Oct 11 '07, 10:53 PM.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Just take the value from the text box and put hashes (#) around it in the SQL string. For example...
    [CODE=vb]Dim strSearch As String
    strSearch = "SELECT * FROM [TableName] WHERE [FieldName] = #" & Textbox.Text & "#"[/CODE]
    Last edited by Killer42; Oct 15 '07, 09:38 PM. Reason: Corrected the opening quote mark

    Comment

    • abdull07
      New Member
      • Oct 2007
      • 5

      #3
      thanks Killer42 for ur help. i'll try it.

      Comment

      • shaileshb
        New Member
        • Jun 2007
        • 27

        #4
        Select * From [TABLENAME] Where [DateFieldName] = #" & format(textbox. text, "MM/dd/yyyy") & "#"

        Comment

        Working...