C
chris
Hi
I am trying to get wizard generated code that drives a
button into a custom toolbar item.
I have converted the code from the button built by the
wizard into a module. I attempted to convert the sub into
a function so that I could point the 'Action' field in
the custom menu item...but then I get a message
stating "The Object doesn't contain the automation
object 'myModuleName' ".
No doubt I have incorrectly converted the sub to a
function - or maybe something entirely different is wrong?
Any suggestions?
Follows is the origianal button code from and then my
attempt to make it a function:
Code generated by wizard driving button:
******************************************************
Private Sub btnFrmClientsToFrmCP_Click()
On Error GoTo Err_btnFrmClientsToFrmCP_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCostProjection"
stLinkCriteria = "[Social_ Security]=" & "'" & Me![Social
Security] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Close Clients form
DoCmd.Close acForm, "Clients"
Exit_btnFrmClientsToFrmCP_Click:
Exit Sub
Err_btnFrmClientsToFrmCP_Click:
MsgBox Err.Description
Resume Exit_btnFrmClientsToFrmCP_Click
End Sub
**************************************
My attempt at making it a function so it can be used as a
custom toolbar item (which needs to be a function):
*************************************
Function btnFrmClientsToFrmCP_Action()
On Error GoTo Err_btnFrmClientsToFrmCP_Action
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCostProjection"
stLinkCriteria = "[Social_ Security]=" & "'" & Me![Social
Security] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Close Clients form
DoCmd.Close acForm, "Clients"
Exit_btnFrmClientsToFrmCP_Action:
Exit Function
Err_btnFrmClientsToFrmCP_Action:
MsgBox Err.Description
Resume Exit_btnFrmClientsToFrmCP_Action
End Function
**********************************************
Any help or hints are greatly appreciated.
Chris
I am trying to get wizard generated code that drives a
button into a custom toolbar item.
I have converted the code from the button built by the
wizard into a module. I attempted to convert the sub into
a function so that I could point the 'Action' field in
the custom menu item...but then I get a message
stating "The Object doesn't contain the automation
object 'myModuleName' ".
No doubt I have incorrectly converted the sub to a
function - or maybe something entirely different is wrong?
Any suggestions?
Follows is the origianal button code from and then my
attempt to make it a function:
Code generated by wizard driving button:
******************************************************
Private Sub btnFrmClientsToFrmCP_Click()
On Error GoTo Err_btnFrmClientsToFrmCP_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCostProjection"
stLinkCriteria = "[Social_ Security]=" & "'" & Me![Social
Security] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Close Clients form
DoCmd.Close acForm, "Clients"
Exit_btnFrmClientsToFrmCP_Click:
Exit Sub
Err_btnFrmClientsToFrmCP_Click:
MsgBox Err.Description
Resume Exit_btnFrmClientsToFrmCP_Click
End Sub
**************************************
My attempt at making it a function so it can be used as a
custom toolbar item (which needs to be a function):
*************************************
Function btnFrmClientsToFrmCP_Action()
On Error GoTo Err_btnFrmClientsToFrmCP_Action
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCostProjection"
stLinkCriteria = "[Social_ Security]=" & "'" & Me![Social
Security] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Close Clients form
DoCmd.Close acForm, "Clients"
Exit_btnFrmClientsToFrmCP_Action:
Exit Function
Err_btnFrmClientsToFrmCP_Action:
MsgBox Err.Description
Resume Exit_btnFrmClientsToFrmCP_Action
End Function
**********************************************
Any help or hints are greatly appreciated.
Chris