PDA

Click to See Complete Forum and Search --> : Extreme POPUP mnu problem


StevenH
Nov 27th, 2000, 06:55 PM
I have a db and in the db i have two fields Main and Sub

I want to be able to click on a button and a menu appears (displaying the records from Main) and the corresponding sub menu (Dispalying the SUB field)...

On my form I have two text boxes one for Main and one for Sub... when the admin enters this info it will place it into the db and the records will be updated in the menu when it displays.... i have looked all over the web and this is very hard to find some sample for this...

Is it possible..... if so can you please show me some code on how to do this... you will save my soul


thanks
Stevie

Wak
Nov 27th, 2000, 09:17 PM
For this code to work I am assuming:
1.) The sub's textbox is name txtSub
2.) The Main's textbox name is txtMain
3.) You are using the data control.
4.) There is at least one existing menu In each mnuItemMain and mnuItemSub. Its visible property can be set to false.
5.) On the menu Item Click you wish to find that record.

Need any more help email me.

This may help:

Private Sub Form_Activate()
dtaMenu.movefirst

do until dtaMenu.recordset.EOF
Load mnuItemMain(mnuItemMain.count + 1)
mnuItemMain(mnuItemMain.count).caption = _ txtMain.text
load mnuItemSub(mnuItemSub.count + 1)
mnuItemSub(mnuItemSub.count).caption = _
txtSub.text

loop

dtaMenu.recordset.movefirst

End Sub

Private Sub mnuItemMain(index as Integer)

Select Case index
Case 1
'Sime kind of Default menu action
Case Else
RunMainMenuAction(index)
End Select

End Sub

Private Sub RunMainMenuAction(Index as integer)
dtaMenu.Recordset.FindFirst "Main like '" & UCase _(mnuItemMain(index).caption) & "'"

end Sub

Private Sub mnuItemSub(index as Integer)

Select Case index
Case 1
'Sime kind of Default menu action
Case Else
RunSubMenuAction(index)
End Select

End Sub

Private Sub RunSubMenuAction(Index as integer)
dtaMenu.Recordset.FindFirst "Sub like '" & UCase _(mnuItemSub(index).caption) & "'"

end Sub

Hope it works