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) |
Tidak ada komentar:
Posting Komentar