I have a customer provide his or her SSN. If the SSN matches a record in a table the form opens specifically on that record (no problem). If the SSN doesn't match a record, the form adds a new record (again, no problem).
The issue I'm having is with the new record. The customer is able to scroll through other records (page up, page down), which is a no-no. I need the form to be locked on the new record. I've posted my code below. Any suggestions would be appreciated.
Private Sub Command543_Click()
On Error GoTo Err_Command543_Click
Dim strCriteria As String
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
strCriteria = "[SSN] = """ & Me.txtTOGO2 & """"
rst.FindFirst strCriteria
If rst.NoMatch Then
DoCmd.OpenForm "frmCustomerInput3"
DoCmd.GoToRecord , , acNewRec
Else
Me.Bookmark = rst.Bookmark
rst.Close
Set rst = Nothing
Me.Transfer = -1
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendSGLIAmt", acViewNormal, acEdit
DoCmd.OpenQuery "qryDeleteTransferCheck", acViewNormal, acEdit
DoCmd.SetWarnings True
DoCmd.OpenForm "frmCustomerInput3", , , "SSN = '" & Me.SSN & "'"
End If
Exit_Command543_Click:
Exit Sub
Err_Command543_Click:
MsgBox Err.Description
Resume Exit_Command543_Click
End Sub
The issue I'm having is with the new record. The customer is able to scroll through other records (page up, page down), which is a no-no. I need the form to be locked on the new record. I've posted my code below. Any suggestions would be appreciated.
Private Sub Command543_Click()
On Error GoTo Err_Command543_Click
Dim strCriteria As String
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
strCriteria = "[SSN] = """ & Me.txtTOGO2 & """"
rst.FindFirst strCriteria
If rst.NoMatch Then
DoCmd.OpenForm "frmCustomerInput3"
DoCmd.GoToRecord , , acNewRec
Else
Me.Bookmark = rst.Bookmark
rst.Close
Set rst = Nothing
Me.Transfer = -1
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendSGLIAmt", acViewNormal, acEdit
DoCmd.OpenQuery "qryDeleteTransferCheck", acViewNormal, acEdit
DoCmd.SetWarnings True
DoCmd.OpenForm "frmCustomerInput3", , , "SSN = '" & Me.SSN & "'"
End If
Exit_Command543_Click:
Exit Sub
Err_Command543_Click:
MsgBox Err.Description
Resume Exit_Command543_Click
End Sub