Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Jan 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    acFormadd (Access 2003)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: acFormadd (Access 2003)

    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?

  3. #3
    New Lounger
    Join Date
    Jan 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: acFormadd (Access 2003)

    Hans,

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

    Thanks,
    Joey

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: acFormadd (Access 2003)

    It depends on what the code does.

  5. #5
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: acFormadd (Access 2003)

    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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: acFormadd (Access 2003)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •