Doubleclick Item on ListBox to Open Form

ny1994rangers

New member
Local time
Today, 03:21
Joined
Mar 28, 2012
Messages
3
I'm new to Access so I apologize if I've done something drastically wrong.

Currently I have a search form that populates a listbox. I did some digging online and found code that when you doubleclick a line item in teh listbox, it looks at the ID # of the item, and opens up a data entry form and goes right to that ID #. That code is:
DoCmd.OpenForm "Add/Update Inquiries", , , "[ID]=" & Me.List93

List93 is the name of the listbox.

Another field that is populated in the listbox is [Record Type]. How can I change that code to open "Add/Update Inquiries" if the Record Type is "Inquiry" and to open "Data Management" if the Record Type is "Data Management"

Thanks for any help.
 
You can use an If/Then/Else block to test the value and open the appropriate form. You'd access the value with the column property:

Me.List93.Column(3)

where 3 is the number of the column containing the desired info. Hint, the Column property is zero based, so 3 is the 4th column.
 
Worked like a charm! Thanks so much!
 
Happy to help, and welcome to the site!
 

Users who are viewing this thread

Back
Top Bottom