View Full Version : A command button who select a record


sofie
01-17-2002, 04:18 AM
When I click on the command button, I recieve an inputbox. There I fill in the name of my client. Then when I put on Ok, I would like to recieve only the record of the client.

I tried olready, but I always recieve all the information of all the clients.

What am I doing wrong?

Who can help me?

Here is the code I made:
Private Sub cmdSearchClient_Click()
Dim Db As CurrentProject
Dim frm As Form_frmKlantenfiche
Dim Klantennaam, strSQL As String
Set Db = CurrentProject
Klantennaam = InputBox("Which client are you searching for? ")
strSQL = "Select * from frmKlantenfiche where naam_kl=" & Klantennaam
DoCmd.OpenForm "frmKlantenfiche"
Naam_kl.SetFocus
End Sub

wh00t
01-17-2002, 04:48 AM
If the command button is on the same form, you can try this

Me.Filter = "naam_kl = [Which Client are you searching for?]"
Me.FilterOn = True
naam_kl.SetFocus