Hello everybody...
I'have bound a database to my form, and it displays the record of some fields from my database. I want to make the displayed record so that it can be searched by clicking the "find" button by the related searching categories. Below are coding that i've used..
[Private Sub Command2_Click()
prompt$ = "Sila masukkan nombor rujukan permohonan yang berkenaan."
'get string to be used in the Nombor Rujukan field search
SearchStr$ = InputBox(prompt$, "Mencari rekod berdasarkan nombor rujukan")
Data1.Recordset.Index = "ReferenceNumb" 'use reference numb database field
Data1.Recordset.Seek "=", SearchStr$ 'and search
If Data1.Recordset.NoMatch Then 'if no match
Data1.Recordset.MoveFirst 'go to first record
End If
End Sub]
[Private Sub Command2_Click()
prompt$ = "Sila masukkan nombor rujukan permohonan yang berkenaan."
'get string to be used in the Nombor Rujukan field search
SearchStr$ = InputBox(prompt$, "Mencari rekod berdasarkan nombor rujukan")
Data1.Recordset.Index = "ReferenceNumb" 'use reference numb database field
Data1.Recordset.Seek "=", SearchStr$ 'and search
If Data1.Recordset.NoMatch Then 'if no match
Data1.Recordset.MoveFirst 'go to first record
End If
End Sub]
[Private Sub Command4_Click()
prompt$ = "Sila masukkan status permohonan berkenaan. Samada Approved atau Not approved"
'get string to be used in the status field search
SearchStr$ = InputBox(prompt$, "Mencari rekod berdasarkan status permohonan")
Data1.Recordset.Index = "Status" 'use status database field
Data1.Recordset.Seek "=", SearchStr$ 'and search
If Data1.Recordset.NoMatch Then 'if no match
Data1.Recordset.MoveFirst 'go to first record
End If
End Sub]
Sorry for using some Malay language words in the above coding. I hope anybody experts in this field could kindly plz tell me, what's wrong with the coding, since i got the coding from a Microsoft Press book. (Microsoft VB6 Professional Step By Step, 2nd Edition).
For your information, i'm using VB6.0 with service pack 6.0, and create the database using Microsoft Access 2003.