command button on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
Back
Top