Hi to everyone. it's me again.
sorry for always troubling you guys but the thing is i'm on my last chance to graduate and i have my dental system working and everything is all set but the trouble is i'm having problems with the Find/Search button in which wherein when the user click on the Search/Find(command button) it would open up a new form with One label(label1) named as Enter Patient Number and a text box(text1) and 3 command buttons
SEARCH Patient History
SEARCH Patient Form
EXIT
and since it's a search form i put in two Data Bar, the one wherein you the codings would start as Data1.recordset.addnew etc....
and the reason why it's two Data Bar is because the search form would search a two kinds of patient record, the patient history, which would include the medical records of that certain patient and the patient form which would include the necessary Patient's Information such as Address, Date of birth etc.
the thing is i don't quite get it how to make that search button work. T__T forgive me, i'm pathetic.
i tried to copy down notes from the book VB6 databases by charles williams and all it shows there are how to use the search button using Adodc.
what i did now is tried to replace the necessary Adodc terms with Data1 and i still can't get it right.
in the book it stated about using strings and adding indexes to the labels and text boxes of the form wherein the criteria for searching would work. in my part the criteria for searching would just be patient number so what i did is i put and index number to the Patient number label and the Patient Number text box. i put 0(zero) on both of it.
here's a copy of the coding that i used.
Public Sub FindString()
Dim strFind As String
Dim intFields As Integer
If Trim(txtsearch) <> "" Then
strFind = Trim(Command1)
With Form4.Data1.Recordset
Do Until .EOF
For intFields = 0 To 1
If InStr(1, Form4.txtnumber(intFields), strFind, _
vbTextCompare) > 0 Then
Form4.txtnumber(intFields).SelStart = InStr(1, Form4.txtnumber(intFields), _
strFind, vbTextCompare) - 1
Form4.txtnumber(intFields).SelLength = Len(strFind)
Form4.txtnumber(intfield).SetFocus
Exit Sub
End If
Next
.MoveNext
DoEvents
Loop
MsgBox "Record Not Found"
.MoveFirst
End With
End If
Exit Sub
End Sub
Private Sub Command1_Click()
If Form4.Data1.Recordset.RecordCount > 0 Then
Form4.Data1.Recordset.MoveFirst
Call FindString
Else
MsgBox "Recordset is Empty"
End If
End Sub
Please kindly help me T_____T