search form problem

P

pankaj

I am attaching code of a serch form but i am not able to run search on other
computer.
Please solve as Format Error comes when date wise search button is pressed

Private Sub cmdFilter_Click()
'
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#yyyy\/mm\/dd\#"


If Not IsNull(Me.txtserialsearch) Then
strWhere = strWhere & "([Serial_no] = """ & Me.txtserialsearch &
""") AND "
End If

If Not IsNull(Me.txtdealername) Then
strWhere = strWhere & "([dealer_name] Like ""*" & Me.txtdealername &
""") AND "
End If



'Manufacturing date search'
If Not IsNull(Me.txtfromdate) Then
strWhere = strWhere & "([Manuf_date] >= " & Format(Me.txtfromdate,
conJetDate) & ") AND "
End If

If Not IsNull(Me.txttodate) Then
strWhere = strWhere & "([Manuf_date] < " & Format(Me.txttodate + 1,
conJetDate) & ") AND "
End If


'Shipping Date Search'
If Not IsNull(Me.txtsfromdate) Then
strWhere = strWhere & "([Shipping_date] >= " &
Format(Me.txtsfromdate, conJetDate) & ") AND "
End If


If Not IsNull(Me.txtstodate) Then
strWhere = strWhere & "([Shipping_date] < " & Format(Me.txtstodate +
1, conJetDate) & ") AND "
End If





lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)

Me.Filter = strWhere
Me.FilterOn = True
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top