I want to use a form as a popup based on selection from a listbox. I already have it working, but I have to create a different form for each selection. Can I, based on the below table, pass the parameters of LgDesc and SubMenuName to a single form and have that form change based on listbox selection? If so, how do I do that in code? Website? Pass thread dealing with this?
I have a table: tblMenuItems
LgID
LgDesc
MenuName
SubMenuName
DirName
SortOrder
This is the code on the form for the listbox:
Option Compare Text
Option Explicit
Private Sub lstMain_Click()
Me.lstSubDirectory.Requery
DoCmd.OpenForm "frmpopup"
End Sub
Private Sub lstSubDirectory_Click()
DoCmd.OpenForm "xfrmGrid", acNormal, , , , , _
DLookup("DirName", "tblMenuItems", _
"MenuName = " & Chr$(34) & Me.lstSubDirectory & Chr$(34)) & Me.lstSubDirectory & "\"
I have a table: tblMenuItems
LgID
LgDesc
MenuName
SubMenuName
DirName
SortOrder
This is the code on the form for the listbox:
Option Compare Text
Option Explicit
Private Sub lstMain_Click()
Me.lstSubDirectory.Requery
DoCmd.OpenForm "frmpopup"
End Sub
Private Sub lstSubDirectory_Click()
DoCmd.OpenForm "xfrmGrid", acNormal, , , , , _
DLookup("DirName", "tblMenuItems", _
"MenuName = " & Chr$(34) & Me.lstSubDirectory & Chr$(34)) & Me.lstSubDirectory & "\"