• DoCmd.OpenForm in add mode (A2000)

    Author
    Topic
    #406308

    Unsure of syntax in the DoCmd to open the form in data entry mode. Can you assist?

    Dim strFormName As String
    Dim frm As Form

    strFormName = “frmEnterCSZ”

    DoCmd.OpenForm strFormName
    Set frm = Forms(strFormName)

    E

    Viewing 1 reply thread
    Author
    Replies
    • #841608

      Use this:

      DoCmd.OpenForm strFormName, , , , acFormAdd

      or

      DoCmd.OpenForm FormName:=strFormName, DataMode:=acFormAdd

      The first uses arguments by position, the second by name, but they do exactly the same.

      • #841616

        Thanks. I was doing this:

        DoCmd.OpenForm (strFormName, , , , acFormAdd)

        • #841628

          DoCmd.OpenForm is not a function, but a procedure, so you shouldn’t use brackets, unless you use Call:

          Call DoCmd.OpenForm(strFormName, , , , acFormAdd)

        • #841629

          DoCmd.OpenForm is not a function, but a procedure, so you shouldn’t use brackets, unless you use Call:

          Call DoCmd.OpenForm(strFormName, , , , acFormAdd)

      • #841617

        Thanks. I was doing this:

        DoCmd.OpenForm (strFormName, , , , acFormAdd)

    • #841609

      Use this:

      DoCmd.OpenForm strFormName, , , , acFormAdd

      or

      DoCmd.OpenForm FormName:=strFormName, DataMode:=acFormAdd

      The first uses arguments by position, the second by name, but they do exactly the same.

    Viewing 1 reply thread
    Reply To: DoCmd.OpenForm in add mode (A2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: