A command button who select a record

sofie

Registered User.
Local time
Today, 15:51
Joined
Jan 17, 2002
Messages
12
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
 
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
 

Users who are viewing this thread

Back
Top Bottom