D
Don Seckler
I have a data entry form called Draw. This form is used to enter data
in the table called Draw. The table has the following fields:
WholesalerID, MagID, IssueID, CopiesDist, and the index is called
DrawIndex. The DrawIndex is a combination index that uses the
combination of these three fields WholesalerID, MagID, IssueID to
ensure that each record is unique.
When a used tries to enter data that has a the same WholesalerID,
MagID, IssueID combination as an existing record, I want another form
called EditDrawForm to open so they can modify the existing record if
they choose to do so.
How do I pass the existing record to the new form?
Here's my script so far. Any help would be greatly appreciated.
Someone suggested OpenArgs, but I'm not sure how to use that here...
Option Compare Database
Private Sub ButtonAddDraw_Click()
On Error GoTo Err_ButtonAddDraw_Click
DoCmd.GoToRecord , , acNewRec
Exit_ButtonAddDraw_Click:
Exit Sub
Err_ButtonAddDraw_Click:
Select Case Err.Number
Case 2105
Err.Clear
'* Display my custom message box
If MsgBox("The draw has already been entered for this issue.
Would you like to edit it?", vbYesNo) = vbYes Then
DoCmd.OpenForm "MyForm"
Else
End If
GoTo Exit_ButtonAddDraw_Click
Case Else
MsgBox Err.Description
End Select
Resume Exit_ButtonAddDraw_Click
End Sub
in the table called Draw. The table has the following fields:
WholesalerID, MagID, IssueID, CopiesDist, and the index is called
DrawIndex. The DrawIndex is a combination index that uses the
combination of these three fields WholesalerID, MagID, IssueID to
ensure that each record is unique.
When a used tries to enter data that has a the same WholesalerID,
MagID, IssueID combination as an existing record, I want another form
called EditDrawForm to open so they can modify the existing record if
they choose to do so.
How do I pass the existing record to the new form?
Here's my script so far. Any help would be greatly appreciated.
Someone suggested OpenArgs, but I'm not sure how to use that here...
Option Compare Database
Private Sub ButtonAddDraw_Click()
On Error GoTo Err_ButtonAddDraw_Click
DoCmd.GoToRecord , , acNewRec
Exit_ButtonAddDraw_Click:
Exit Sub
Err_ButtonAddDraw_Click:
Select Case Err.Number
Case 2105
Err.Clear
'* Display my custom message box
If MsgBox("The draw has already been entered for this issue.
Would you like to edit it?", vbYesNo) = vbYes Then
DoCmd.OpenForm "MyForm"
Else
End If
GoTo Exit_ButtonAddDraw_Click
Case Else
MsgBox Err.Description
End Select
Resume Exit_ButtonAddDraw_Click
End Sub