Hi
I have various forms for users to enter data. When the form opens I wish to warn them of about the form adding records. To this end I have created a public sub
Public Sub AddRecordsub()
Dim Message, Title, MyValue
Message = "Entering This Form Will Add Records. Are You Sure This Is What You Want To Do" ' Set prompt.
Title = "Add Record Message" ' Set title.
' Display message, title.
retValue = MsgBox(Message, Title, vbYesNo)
If retValue = vbYes Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Within the main form I have a command button to open the form with the code below
Private Sub cmdnewassitclient_Click()
On Error GoTo Err_cmdnewassitclient_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmassistcliententry"
AddRecordsub
Exit_cmdnewassitclient_Click:
Exit Sub
Err_cmdnewassitclient_Click:
MsgBox Err.description
Resume Exit_cmdnewassitclient_Click
End Sub
The problem I am having is when the Public sub is called I am getting an error saying Function or Sub is not defined.
Any ideas where I am going wrong and also am I heading in the right direction with my code as this is only the second Public Sub/Function I have created
Thanks
Richard
I have various forms for users to enter data. When the form opens I wish to warn them of about the form adding records. To this end I have created a public sub
Public Sub AddRecordsub()
Dim Message, Title, MyValue
Message = "Entering This Form Will Add Records. Are You Sure This Is What You Want To Do" ' Set prompt.
Title = "Add Record Message" ' Set title.
' Display message, title.
retValue = MsgBox(Message, Title, vbYesNo)
If retValue = vbYes Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Within the main form I have a command button to open the form with the code below
Private Sub cmdnewassitclient_Click()
On Error GoTo Err_cmdnewassitclient_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmassistcliententry"
AddRecordsub
Exit_cmdnewassitclient_Click:
Exit Sub
Err_cmdnewassitclient_Click:
MsgBox Err.description
Resume Exit_cmdnewassitclient_Click
End Sub
The problem I am having is when the Public sub is called I am getting an error saying Function or Sub is not defined.
Any ideas where I am going wrong and also am I heading in the right direction with my code as this is only the second Public Sub/Function I have created
Thanks
Richard