Error in search button (1 Viewer)

luzz

Registered User.
Local time
Today, 11:49
Joined
Aug 23, 2017
Messages
346
Hi all, I have a search button on my form and when I click on search it is unable to show only the data that I search.

Below is my coding:

Code:
Private Sub txtSearch_Click()
'declare variable
Dim sql As String
    'Determine and return the number of records in UnmatchFabricPOqry
    If DCount("*", "UnmatchNewFabricPOQry", "PO like '*" & Me.txtKeyword & "*'") = 0 Then
    'Error message will be display if PO number is not found
    MsgBox "No record found,check your PO again!"
    Else
    'If PO number is found, it will retrive the data below from UnmatchFabricPOqry
    sql = "SELECT UnmatchNewFabricPOQry.PO, UnmatchNewFabricPOQry.Date, UnmatchNewFabricPOQry.[Style NO], UnmatchNewFabricPOQry.[GL Lot], UnmatchNewFabricPOQry.PO, UnmatchNewFabricPOQry.[Fabric Cuttable Width], UnmatchNewFabricPOQry.Color, UnmatchNewFabricPOQry.[Our Qty], UnmatchNewFabricPOQry.[Supplier Qty],UnmatchNewFabricPOQry.GSMBeforeWash, UnmatchNewFabricPOQry.Description2, UnmatchFabricPOqry.[GMS Per SqYD], UnmatchNewFabricPOQry.[Remark],UnmatchNewFabricPOQry.[Fabric Weight], UnmatchNewFabricPOQry.[Unit Price],UnmatchNewFabricPOQry.ShipName,UnmatchNewFabricPOQry.[Garment Delivery Date],UnmatchNewFabricPOQry.POStatus, UnmatchNewFabricPOQry.[PO Amend No], UnmatchNewFabricPOQry.GSMAfterWash" _
    & " FROM UnmatchNewFabricPOQry " _
    & " WHERE PO LIKE '*" & Me.txtKeyword & "*' "
    'Click on search button to refresh data
    Me.Lst_PO.Recordset = strSQL
    Me.Lst_PO.Requery
    End If
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:49
Joined
May 7, 2009
Messages
19,245
Try this Vabes
 

Attachments

  • Sample Data_Luzz.zip
    137 KB · Views: 120

Users who are viewing this thread

Top Bottom