cenderawasih
MIS
Hi........I have this code under my FIND button. It works fine. Then just now I refresh the data in my link tables. After that this code does not work as it suppose to.....
This is the code:
Private Sub btnFind_Click()
On Error Resume Next
Dim ssql As String
Dim scriteria As String
scriteria = "WHERE 1=1 "
If Me![txtJobNo] <> "" Then
scriteria = scriteria & " AND QryUpdateRevise.GBMCU like """ & txtJobNo & """"
End If
If Me![txtType] <> "" Then
scriteria = scriteria & " AND QryUpdateRevise.TYPE like """ & txtType & """"
End If
ssql = "SELECT [JOBNO], [TYPE], [OBJECT], [SUBJOB], [ID], [AMT], [DESC], [REVISE] from QryUpdateRevise " & scriteria
Me.Form.RecordSource = ssql
Me.Requery
End Sub
As u see in my codes....I have 2 criteria set for records search...
-> to search base on Job No selected by the user in txtJobNo text box AND base on the Type also selected by user in txtType text box.
This search function works OK for Job No but for searching that according to type (there are 2 types that exist TYPE-A and TYPE-U)....when the user select TYPE-U.....the search function works fine (my system will only display data with TYPE-U) but when the user select TYPE-A.....the search function didn't do it 's job........because my system will display the data for both types...that is TYPE-A and TYPE-U........
I really can't figure out...what is wrong with my codes....
Please help
This is the code:
Private Sub btnFind_Click()
On Error Resume Next
Dim ssql As String
Dim scriteria As String
scriteria = "WHERE 1=1 "
If Me![txtJobNo] <> "" Then
scriteria = scriteria & " AND QryUpdateRevise.GBMCU like """ & txtJobNo & """"
End If
If Me![txtType] <> "" Then
scriteria = scriteria & " AND QryUpdateRevise.TYPE like """ & txtType & """"
End If
ssql = "SELECT [JOBNO], [TYPE], [OBJECT], [SUBJOB], [ID], [AMT], [DESC], [REVISE] from QryUpdateRevise " & scriteria
Me.Form.RecordSource = ssql
Me.Requery
End Sub
As u see in my codes....I have 2 criteria set for records search...
-> to search base on Job No selected by the user in txtJobNo text box AND base on the Type also selected by user in txtType text box.
This search function works OK for Job No but for searching that according to type (there are 2 types that exist TYPE-A and TYPE-U)....when the user select TYPE-U.....the search function works fine (my system will only display data with TYPE-U) but when the user select TYPE-A.....the search function didn't do it 's job........because my system will display the data for both types...that is TYPE-A and TYPE-U........
I really can't figure out...what is wrong with my codes....
Please help