Open forms and reports from listbox

thatlem

Registered User.
Local time
Today, 16:18
Joined
Jan 29, 2009
Messages
115
I would like to be able to have users make a selection from a listbox which would then either open a data entry form or run a report, depending on the listbox.

I have created a listbox based on a query off the hidden system MSysObject.Name object which displays the list fine. But when I click on a selection, nothing happens. I am assuming I need to tell the system what to do with the selection, but can't seem to figure out just how to do that.

Any suggestions, or even if you have a better way altogether...
:confused:
 
Yes, you do have to tell Access what to do, using the AfterUpdate event of the ListBox! Assuming the Multi-Select Property of the ListBox is set to No (which is the Default)

Code:
Private Sub FormOpenListBox_AfterUpdate()
  stDocName = Me.FormOpenListBox
  DoCmd.OpenForm stDocName
End Sub
Just substitute your ListBox name for FormOpenListBox.
 
I would like to be able to have users make a selection from a listbox which would then either open a data entry form or run a report, depending on the listbox.

I have created a listbox based on a query off the hidden system MSysObject.Name object which displays the list fine. But when I click on a selection, nothing happens. I am assuming I need to tell the system what to do with the selection, but can't seem to figure out just how to do that.

Any suggestions, or even if you have a better way altogether...
:confused:

Here is an example that might help:
 

Attachments

Users who are viewing this thread

Back
Top Bottom