command button on form

J

J.Woo

Hi,

I like to know how to open the form and find specific data using command button
I created command button and want to chose that option in command button wizard but kept showing
it couldn't because the error message said " you have chosen form that can't be linked....
I appreciate your help.
 
F

fredg

Hi,

I like to know how to open the form and find specific data using command button.
I created command button and want to chose that option in command button wizard but kept showing
it couldn't because the error message said " you have chosen form that can't be linked...."
I appreciate your help.
Not clear on what kind of data you want to see.

1) You can use the Where clause argument in the OpenForm method:
DoCmd.OpenForm "frmEmployees", , ,"[EmpID] = " & Me![EmpID]

In the above example, the Employees form will open to the Employee
whose ID matches the ID shown on the current form.

Or ...
2) You could apply a filter to the 2nd form:
DoCmd.OpenForm "frmOrders"
forms!frmOrders.Filter = "[LastName] = " & chr(34) & Me![LastName] &
chr(34)
forms!frmrders.FilterOn = True

If the LastName shown on the current form was "Smith", the new form
would show only records for all customers named Smith.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top