listbox event

J

Judy

Is there a way to create a list box with names of a table, click the name,
and it would immediately bring up all records in a subform relating to that
name?
 
G

Graham R Seach

Judy,

Create a bound form that displays all records from the table. Then in the
DblClick event for the listbox, add the following pseudo-code:
DoCmd.OpenForm "frmMyForm", , , "TableName = """ & Me!lstTables &
""""

The RowSource property of your list should be as follows:
SELECT [Name]
FROM MSysObjects
WHERE [Type] = 1 AND Flags = 0
ORDER BY [Name]

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 

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