Command Button - Need Assistance

M

mas100378

Hi,

I have a database that was made for me that has active command buttons for
ID#, last name and Employer. I have since added another text box to the form
for a secondary ID (not really relevent i guess). Anyhow, I have a table
with this secondar ID and I am trying to create a command button (I chose the
binocular icon) but I am confused as to how to get it to link to the table.
Either it doesnt do anything or I get an error.

Looking how to link the command button with my table.

Thanks very much!

MAS
 
J

Jeanette Cunningham

I'm not sure how the buttons are used on your form.
Could you explain what happens when the command buttons for ID#, employer
and last name are clicked.
What do you want to happen when the button for secondary ID is clicked?

Jeanette Cunningham
 
M

mas100378

Hi,

So since my DB has 3300 people in it, I can click the last name command
button and the search box comes up, where I can enter partial/whole last
name. Same with ID#. Actually, with employer, there is not a command
button, so I have to do a CTRL + F. But I would like it to be where I click
a command box and it opens up a search screen where I input the secondary Id
and it is referencing the secondary ID table.

Thanks in advance,
 
J

Jeanette Cunningham

Use code like this:
Note: Replace Command7 with the name of your command button.
Replace NameOfField with the name of the control for the field you want to
search.

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click


Me.NameOfField.SetFocus
DoCmd.RunCommand (acCmdFind)

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

Jeanette Cunningham
 
Top