Share via

Access Form Incrementing ID

Anonymous
2022-10-17T15:35:03+00:00

Hi,

I've got a main form in Access where I'm entering most of the information to fill my main data table. Under certain conditions, I've set up a button to become visible on the form, which brings me to a modal form with some additional fields, which go to the same data table. For some reason, when I open the modal form it's adding data to a new entry, rather than the same entry as the main form. Does anyone know why that might be/how to fix it?

Microsoft 365 and Office | Access | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Anonymous
    2022-10-17T16:20:59+00:00

    I'm doing scientific (archaeological) research, so a lot of data isn't unusual; I'm making about 10-30 measurements for each entry. In this case, I'm recording data about artifacts, and wanted some fields to only appear if they apply to a certain type of artifact. For some of this I made fields visible or invisible based on the selected artifact type, but stone tools in particular require a whole set of extra info, so I put that in the modal form.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-10-17T16:17:26+00:00

    Okay, I'll try that -- thanks!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-10-17T16:05:03+00:00

    If you use the solution suggested by Tom, be sure to save the current record with:

    Me.Dirty = False
    

    before opening the second form in dialogue mode.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2022-10-17T15:52:44+00:00

    Another option would be to have the additional fields on a Tab Control; just put them on a second tab to be displayed when needed.

    I'm a bit concerned about your data model though, if you have so many fields that you need two forms to display them all!

    Was this answer helpful?

    0 comments No comments
  5. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2022-10-17T15:45:25+00:00

    You would want to open the modal form to the same record (with same PK value).

    A simple way to do that is to use the WhereCondition argument of DoCmd.OpenForm:

    docmd.openform "myModalForm", WhereCondition:="CustomerID=" & Me.CustomerID, WindowMode:=acDialog

    Was this answer helpful?

    0 comments No comments