Change the first line of your code to:
Public Function Security_Menu(ActiveButton As String)
Then in the On Click property for Button1, use:
=Security_Menu("Button1")
and so on for your other buttons.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mike" <in**@baltworld.comwrote in message
news:44**********************************@b1g2000h sg.googlegroups.com...
On Sep 19, 10:02 pm, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
You will need to pass this information to the procedure.
For example:
Private Sub Command3_Click()
Call DoSomething("Command3")
End Sub
Function DoSomething(strWhoCalled As String)
Debug.Print "Called by " & strWhoCalled
End Function
If you need to know which form it was a well, pass the button rather than
its name. You can then examine its Parent.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mike" <i...@baltworld.comwrote in message
news:7d**********************************@k7g2000h sd.googlegroups.com...
I am calling an event from the on click event of a command button. I
cant however figure out how to refrence "which" button was clicked in
the first procedure, in the second procedure... In simplistic terms I
would like the system to know which button was clicked on the parent
form so that it can pull specific requirements within the other
section of code... any help is greatly appreciated...- Hide quoted
text -
- Show quoted text -
Thanks.. I dont quite understand what your saying... here is the code
behind the module... I simply want to be able to call this function
instead of placing all of the code behind each button in each menu..
am I thinking right??
Public Sub Security_Menu()
On Error GoTo Err_Menu_Security_Click
Dim MenuItem As String
Dim UserName As String
Dim dbuser As Variant
Dim AuthUser As Variant
Dim AuthTable As String
Dim ActiveButton As String
Dim ABSecurity As String
ActiveButton = Form_frmEntryInterface. '*****Heres where the
problem is********
AuthTable = "tbl_System_User_Menus"
MenuItem = DLookup("DefaultForm", "tblMenuOptions", "CmdBtnName =
" & "'" & ActiveButton & "'")
ABSecurity = DLookup("CmdBtnSecurity", "tblMenuOptions",
"CmdBtnName = " & "'" & ActiveButton & "'")
UserName = "UserName = " & "'" & CurrentUser() & "'" & "User_Menu
= " & "'" & ABSecurity & "'"
AuthUser = DLookup("[UserName]", AuthTable, UserName)
dbuser = CurrentUser()
If dbuser = AuthUser Then
DoCmd.OpenForm MenuItem, , , , acFormAdd
ElseIf IsNull(AuthUser) Then
MsgBox "Accessor with User Name " & [dbuser] & " is NOT
authorized to perform the selected action. Please contact the system
administrator for access.", vbCritical, "Not Authorized"
End If
Exit_Menu_Security_Click:
Exit Sub
Err_Menu_Security_Click:
MsgBox Err.Description
Call LogError(Err.Number, Err.Description,
"Menu_Security_Module", , False)
Resume Exit_Menu_Security_Click
End Sub