Report Thru Combobox

Beany

Registered User.
Local time
Today, 20:20
Joined
Nov 12, 2006
Messages
155
Hi,

I have a table called tab_main with all the mobile phone users details.

I have form with contains a combobox that lists all the users names alphabetically.

i would like to select a name from the list and only show the details of the individual selected as a report? ie his name, phone number,imei,puk code etc etc.....

How do i do this? Any1 got an example or some code??

im not experienced at all with reports, so please do explain in detail.........

thanks
 
Last edited:
You'll need to use LinkCriteria to id the unique record you select in your combo.

Below is the code I used on the OnClick event of a command button to print a report of a single record. You'll need to put something like this in the after update event of your combo.
A search on 'after update stlinkcrieria ' should point you in the right direction

DoCmd.OpenReport "YourReportName", acPreview, "", "[YourFieldPK]=[Forms]![YourFormName]![ YourFieldPK]"
 
thanks Barry,

will give that a try...............
 
do u have any examples or so that i can look at?

it would be appreciated thanks
 
Beany said:
do u have any examples or so that i can look at?

it would be appreciated thanks
Sorry I've been out of the office for a couple of days. When I get back I'll try to find something.

The general idea is that the Primary key of the record you're on will be a field on your form - visible or not it doesn't matter.

In the after update event of the combo you refer to the PK on your form and tell the report to only show that record.

You may also need a reference to the combo box in the query for your report.
 
Or

Use a query for the recordsource of the form and set the criteria for Name in the query to[Forms]![YourFormName]![YourComboName]
 
If you haven't worked it out yet here's an example.
 

Attachments

Thanks peep,

Barry thats a good example..cheers bud...

will give it a go
 
Barry ur the Man...............

ive got it working, using the example you gave me!!!!!! cheers mate :D :D :D
 
Beany said:
Barry ur the Man...............

ive got it working, using the example you gave me!!!!!! cheers mate :D :D :D

No problem. You'll find stLinkriteria useful in lots of ways - for instance I hate subforms and in one database have split data entry tasks over a few smaller forms - one pops up as the previous one closes, keeping the link on the PK. Probably frowned on by the experts but it works for me.
 

Users who are viewing this thread

Back
Top Bottom