How to keep focus on one record

Novice1

Registered User.
Local time
Today, 00:25
Joined
Mar 9, 2004
Messages
385
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
 
in the form property,
OTHER tab
CYCLE =Current Record
 
Thanks. Tried but I'm still able to see other records via page up and page down
 
Check out the arguments of OpenForm, and use the one that opens the form in data entry mode.
 
CYCLE =Current Record will NOT let you move up/down.
 
I believe the Cycle property only affects what happens when you hit Tab or Enter when you're on the last control in the tab order. It wouldn't prevent you from navigating to other records via other methods.
 

Users who are viewing this thread

Back
Top Bottom