Searching from Combobox

S

Steve Moss

I have asked this question before but for some reason I cant find the thread
again. I have a combobox on a form called "Select", with a drop down menu of
persons names (from a table). I have a report called "holdings", that shows
which person is holding which book. what i would like is afterupdate of the
combobox on the "Select" form access opens up the "holdings" report with only
the person selected in the combobox on the "Select" Form. I have the code
working up to the point where it opens the Report "Holdings", But thier isnt
any information on it apart from the required headings.
Can anyone help, or suggest a way of achieving this.
 
A

Andy Hull

Hi

This depends how you have set up your combo box.

Check the row source and the bound column.

You may find that the row source is something like...

select PersonID, PersonName from... etc...

and the bound column is 1 (ie PersonID)

So the combo box may well display person names but the value of Me.Select
will be the corresponding PersonID (because that is the bound column).

So you would run the report with code like...

DoCmd.OpenReport "ReportName", acViewPreview, , "PersonID = " & Me.select

and you would need to make sure the report contains the PersonID column
(although it doesn't have to be displayed to the user). I've assumed PersonID
is numeric.

If Me.Select does refer to the person name then the code would be...

DoCmd.OpenReport "ReportName", acViewPreview, , "PersonName = """ &
Me.select & """"

hth

Andy Hull
 

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