Search code examples
vbams-accessms-access-forms

Unable to make Ms Access form blank to enter new records


I have a problem. When I open the Ms Access form to enter new records, it is showing old records. I need it to show a blank form, I have tried me.Refresh, me.Requery and call DoCmd.GoToRecord(,, acNewRec)

What else can i try?

The call DoCmd.GoToRecord(,, acNewRec) line is producing an error: ' a problem occured while Ms Access was communicating with the OLE server or ActiveX control"

Private Sub Form_Load()
    'me.Requery
    'me.Refresh
    Call DoCmd.GoToRecord(, , acNewRec)
    If Not IsNull(Me.SubjectID) Then
        Forms!Data_Pro_Patient_Entry![my_rep].Visible = True
        Call Disable_Schedule_Generation
    Else
        Forms!Data_Pro_Patient_Entry![my_rep].Visible = False
        Call generate_auto_id
    End If
End Sub

Solution

  • if you're opening the form from code, add "acFormAdd" to data DataMode like

    docmd.OpenForm {FormName},acNormal,,,acFormAdd