A
Albert D. Kallal
I find that if you just create the menus using the UI..then you don't have
to boehter with code.
Futher, since you can specify a menu bar for each form..thent he "switcign"
of fomrs will autoamclity switch the avalingl menu otpons for you.
Also, you can most certainly run code for each menu item. You simply place
the name of the function in the on-action property of the menu item.
=MyPrintInvoice()
So, the above setting in the on-action propery will run your function in a
public model called MyPrintInvoice. Note that you need to slightly change
your coding habits..since your menu code now must PICK UP the curretly
active screen. So, my menu code OFTEN looks like:
Public Function MyPrintInvoice:
Dim tblgroupid As Long
Dim frmActive As Form
Set frmActive = Screen.ActiveForm
tblgroupid = frmActive.frmMainClientB.Form!id
If frmActive.InvoiceNumber = 0 Then
' no invoice number yet....gen a new one..
frmActive.InvoiceNumber = GetNextInvoiceNumber()
frmActive.Refresh ' write to disk
etc. etc. etc...
Note how in place of me.InviceNumber I can now use frmActive. So, you need
to as a general rule grab the active screen and shove it into a variable for
a lot of your screen code.
Here is some ideas on using menus to make things easy:
http://www.attcanada.net/~kallal.msn/Articles/UseAbility/UserFriendly.htm
to boehter with code.
Futher, since you can specify a menu bar for each form..thent he "switcign"
of fomrs will autoamclity switch the avalingl menu otpons for you.
Also, you can most certainly run code for each menu item. You simply place
the name of the function in the on-action property of the menu item.
=MyPrintInvoice()
So, the above setting in the on-action propery will run your function in a
public model called MyPrintInvoice. Note that you need to slightly change
your coding habits..since your menu code now must PICK UP the curretly
active screen. So, my menu code OFTEN looks like:
Public Function MyPrintInvoice:
Dim tblgroupid As Long
Dim frmActive As Form
Set frmActive = Screen.ActiveForm
tblgroupid = frmActive.frmMainClientB.Form!id
If frmActive.InvoiceNumber = 0 Then
' no invoice number yet....gen a new one..
frmActive.InvoiceNumber = GetNextInvoiceNumber()
frmActive.Refresh ' write to disk
etc. etc. etc...
Note how in place of me.InviceNumber I can now use frmActive. So, you need
to as a general rule grab the active screen and shove it into a variable for
a lot of your screen code.
Here is some ideas on using menus to make things easy:
http://www.attcanada.net/~kallal.msn/Articles/UseAbility/UserFriendly.htm