Using a Macro on a control button in a form

  • Thread starter Thread starter kdonnel1
  • Start date Start date
K

kdonnel1

Guest
I am using a form to display information contained in a table. Incident Number is my primary key. I want to be able to type in an incident number, press a control button (get record) and have all the other information associated with the incident number (everything else contained in the record) pop up. I have the form designed. You can scroll throgh the records and it shows all the right information. You can add new records to the table by filling out the fields. I have included the "Get Record" control button and tried to attach a macro to it so that it will show all information for the record, but it is not working. Does anyone know how to do this????
 
There are two ways I would approach this.
You could create another form, and make the original form a subform of the new form. The new form would have a combo box on it that would get it's data from the incident number field in your table. After selecting the incident number, the data for that record would show up in the subform.
Or, you could create a separate form with a combo box on it (as described above). The AfterUpdate event for the combo box would have code like this:
Docmd.Openform "YourFormName",,,"[Incident Number] = forms!YourNewForm,YourComboBox"

I can go into more detail for either approach if you like.
 

Users who are viewing this thread

Back
Top Bottom