I have created the following code to run on an Exit button for a form.
Private Sub cmdExit_Click()
DoCmd.SetWarnings False
On Error Resume Next
DoCmd.OpenQuery "ApplicationAccesswithoutUserApps", acViewNormal, acReadOnly ' run the Application Without User Query
DoCmd.OpenQuery "AppendUserApps", acViewNormal, acReadOnly ' run the AppendUserApps Query
DoCmd.Close acForm, "ApplicationAccess", acSaveNo 'Close the Application Access Form
DoCmd.SetWarnings True
End Sub
The problem is the query is creating a new record in the sub-form for the first record in the database.
I have a form with a sub-form. The main form is for viewing current records or adding a new record and the sub-form shows all currently related records for a user.
The form has UserName, Department, Application, Supervisor, Removal Date fields.
The sub-form has UserName and Application fields.
Why is the Exit button code creating a new blank record for the first record in my main table?