Senin, 04 September 2017

[MS_AccessPros] Searc VBA is bring a Data Mismatch error

 

I have the following vba code that searches a form which I found on allen browns page:

 

    Dim strWhere As String                  'The criteria string.
    Dim lngLen As Long                      'Length of the criteria string to append to.
   Const conJetDate = "\#mm\/dd\/yyyy\#"   'The format expected for dates in a JET query string.



'Date field example. Use the format string to add the # delimiters and get the right international format.
    If Not IsNull(Me.txtStartDate) Then
        'strWhere = strWhere & "([DateEntered] >= " & Format(Me.txtStartDate, conJetDate) & ") AND "
        strWhere = strWhere & "([DateEntered] >= " & Format(Me.txtStartDate) & ") AND "
    End If
   
    'Another date field example. Use "less than the next day" since this field has times as well as dates.
    If Not IsNull(Me.txtEndDate) Then   'Less than the next day.
       ' strWhere = strWhere & "([DateEntered] < " & Format(Me.txtEndDate + 1, conJetDate) & ") AND "
       strWhere = strWhere & "([DateEntered] < " & Format(Me.txtEndDate + 1) & ") AND "
      
    End If


I know its the constant conJetDate but I do not know how to adjust to work with my DateEntered field which stores data as 8/29/2017 3:11:28 PM. I have tried it with the conJetDate and with out and they both fail. Any ideas?


Thank you ,


Art Lorenzini

SD


__._,_.___

Posted by: dbalorenzini@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar