Running macro from Combo Box

Graham T

Registered User.
Local time
Today, 08:34
Joined
Mar 14, 2001
Messages
300
I have a search form (frm Search Author Details) containing a combo box, with a row source of:

SELECT [tblMakeAuthor].[strLastName], [tblMakeAuthor].[strFirstName] FROM [tblMakeAuthor] ORDER BY [tblMakeAuthor].[strLastName];

On the On_Click event of this I have attached a macro: mcrOpenAuthorDetailsForm, which should open up the frmAuthorDetails and show all details for the choice of author from combo.

The Where condition in the macro reads: [Forms]![frmAuthorDetails]![strLastName]=[Forms]![frmSearch Author Details]![cboAuthorsList]

On the form to be open there is the field [strLastName], but the frmAuthorDetails form is opening as a blank form showing no fields. I have tried removing the where condition and the form opens no problems, but obviously not at the correct record.

I believe this is obviously a problem with using the combo box to select values and set the Where condition, but have had no luck in working this out.

I have no problem in making this work with code, but need to show this using a macro and combo box. Is this possible?

Thanks in advance - Graham
 
One way is to create a query to display the info you want. In the query under Firstname or whatever the user selects from your combo box to get the record you want put [forms]![frm Search Author Details]![name of the combo box].
Save the query as a form.
Add a command button to the form attach a macro the the button to run the query.
When the user selects from your combo box
and clciks the button, the macro will open the record for you.
Hope this makes sense.
 

Users who are viewing this thread

Back
Top Bottom