Private Sub txtsearch_Click()
with data3.Recordset
a = txtidno.Text
.FindFirst "[id]'" & a & "" '
If .NoMatch Then
MsgBox "Record Not Found", vbInformation, "Search"
Else
txtborrowname.Text = .Fields("borrower's name")
txtcourse.Text = .Fields("course")
txtyear.Text = .Fields("year")
End If
End With
End Sub

("what is the lacking of my code of command button search? is there any other codes to be use in search button?")

Private Sub txtsearch_Click()
with data3.Recordset
a = txtidno.Text
.FindFirst "[id]'" & a & "" '
If .NoMatch Then
MsgBox "Record Not Found", vbInformation, "Search"
Else
txtborrowname.Text = .Fields("borrower's name")
txtcourse.Text = .Fields("course")
txtyear.Text = .Fields("year")
End If
End With
End Sub

'First declare the a as a string
With Data1.Recordset
    Dim a As String

    a = txtidno.Text
    .FindFirst "id ='" & a & "'"
    'You do not have to use [], only if your field has spaces between them as in id no

    If .NoMatch Then
        MsgBox "Record Not Found", vbInformation, "Search"
            Else
        txtborrowname.Text = .Fields("borrower's name")
        txtcourse.Text = .Fields("course")
        txtyear.Text = .Fields("year")
    End If
End With

Did this help?

thank you friend.. but how about this?

Private Sub txtacc1_DblClick()
With data3.Recordset
Dim b As String
b = txtacc1.Text
.FindFirst "[acc1]='" & b & "'"
If .NoMatch Then
MsgBox "Record Not Found", vbInformation, "Search"
Else
txtbooktittle1.Text = .Fields("book")
txtauthor1.Text = .Fields("author")
txtcall1.Text = .Fields("call#")
End If
End With
End Sub


(it is the same from the command button of the code of search?)

I'm not sure what you are asking here? Did you receive an error? If so where.

yes.. but the locking is the data source that i had.. i forgot to put an data source..

thank you...

i mean is they are the same code of the "Private Sub txtacc1_DblClick()" to "txtsearch_Click()"

Yes, the code seems fine. The one is only single click and the other is double click.

Happy coding. Please mark the thread as solved, thanks.

Private Sub txtsearch_Click()
with data3.Recordset
a = txtidno.Text
.FindFirst "[id]'" & a & "" '
If .NoMatch Then
MsgBox "Record Not Found", vbInformation, "Search"
Else
txtborrowname.Text = .Fields("borrower's name")
txtcourse.Text = .Fields("course")
txtyear.Text = .Fields("year")
End If
End With
End Sub

("what is the lacking of my code of command button search? is there any other codes to be use in search button?")

Is this MS Access or just plain VB? if it's access, several things are missing.

It is a Data Control in VB6 connected to MS Access, nothing missing except for some error trapping code like BOF or EOF.

yes it is a plain vb....

Hi JunJun, did you manage to solve your problem? If you did, please mark as solved, thanks, otherwise let us know if there is more problems.

funnfunonly, I think you posted to the incorrect thread. Your end has no meaning in this thread...

hi can you help me to create a system for student organization?

No, I can not. We do not do others projects here on Daniweb.

If you pay us, we might consider this...

Open your OWN post as well, we do not allow hijackers either!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.