While executing the ADDRECORD command I get the following message from Access(97): "You can't go to the speciedif record. You may be at the end of a recordset." The form were this takes place is link to a table.
Following is the code for the function used by the command and the command itself:
=======================================================
Function Message(strAction As String) As Long
Dim strMsg As String
strMsg = "Do you want to " + Trim(strAction) + " this Record?"
Message = MsgBox(strMsg, lngDisp, strTitle)
End Function
=======================================================
Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click
If Message("ADD" = vbYes Then
[CreateDate] = Date
[UpdateBy] = "Admin"
DoCmd.GoToRecord , , acNewRec
MsgBox "Representative Added to this Petition.", , strTitle
Else
Me![cmbRepsId].SetFocus
End If
Exit_cmdAddRecord_Click:
Exit Sub
Err_cmdAddRecord_Click:
MsgBox Err.Description
Resume Exit_cmdAddRecord_Click
End Sub
=======================================================
I use the same methodology in other forms and tables and do not have this problem.
Any help is greatly appreciated.
Rene
Following is the code for the function used by the command and the command itself:
=======================================================
Function Message(strAction As String) As Long
Dim strMsg As String
strMsg = "Do you want to " + Trim(strAction) + " this Record?"
Message = MsgBox(strMsg, lngDisp, strTitle)
End Function
=======================================================
Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click
If Message("ADD" = vbYes Then
[CreateDate] = Date
[UpdateBy] = "Admin"
DoCmd.GoToRecord , , acNewRec
MsgBox "Representative Added to this Petition.", , strTitle
Else
Me![cmbRepsId].SetFocus
End If
Exit_cmdAddRecord_Click:
Exit Sub
Err_cmdAddRecord_Click:
MsgBox Err.Description
Resume Exit_cmdAddRecord_Click
End Sub
=======================================================
I use the same methodology in other forms and tables and do not have this problem.
Any help is greatly appreciated.
Rene