• acFormadd (Access 2003)

    Author
    Topic
    #437820

    I have a switchboard with the following private functions for opening forms. The problem is that the OpenFormsAdd() Function only works with one form which is based on a table. The other form is based on a query, but with not open in Add mode, instead it shows all records. Can acFormadd be used with a query recordsource?

    Private Function OpenForms(strFormName As String)

    DoCmd.OpenForm strFormName

    End Function

    Private Function OpenFormsAdd(strFormName As String)

    DoCmd.OpenForm strFormName, , , , acFormAdd

    End Function

    Thanks a lot,
    Joey

    Viewing 0 reply threads
    Author
    Replies
    • #1042041

      It shouldn’t matter whether a form is based on a table, a query or a SQL statement. Do you have code in the On Open or On Load event of the problem form?

      • #1042083

        Hans,

        That was it. I guess that is a limitation of acFormAdd that I did not know.

        Thanks,
        Joey

        • #1042088

          It depends on what the code does.

          • #1088380

            Hi, Hans,
            I’ll latch on to this message thread, in case anyone else is searching for answers — and you know, I’ve probably re-learned this a few times (must be all that mercury-laden fish I’ve eaten): my “acformadd” call had started failing. At first, I thought it was corruption, and pulled forms into a new database, etc. etc. Then I went searching, and, triggered by this thead, I went back and looked at the “on open” event of the form. It turned out that I was setting an “orderby” at the top of the module (to solve a different problem … ignore this part). I’m using openargs to determine whether the form is showing all, filtered or new, so I moved the “orderby” part so that “New” will not come across it, and voila, it works. I don’t know why an “orderby” would blow a form opened in data entry mode, but apparently, it does — probably because the default settings for the form are the usual “allow Edits,” etc.
            thx
            Pat

            • #1088618

              Thanks, that’s a useful addition. Changing the sort order or filter of a form opened in add mode will display all records.

    Viewing 0 reply threads
    Reply To: acFormadd (Access 2003)

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

    Your information: