Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pre saving record (MS Access 2003)

    Difficult one to explain. I have a mainform with a subform. The forms are related. The subform used to have 1 field to hold a persons name, however the users were adding in several names seperated by commas etc.

    I have redesigned the tables to include a list of common names together with a Junction table between the two forms.

    The problem is when addiing a new record in the subform. I can enter all the data in the fields and then save the record, that part is ok. However during the operation of adding a new record, the record itself is not in a saved mode for me to add and save names in the names section.

    I use the code DoCmd.GoToRecord , , acNewRec to get a new record, and use DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 to save the record, but am stuck trying to query the subform to the new value of ID2 which is the new primary key, so that the rest of the fields, ie names collection can be saved.

    I then would take a final look at the completed data to inform the user of incomplete data before the final action of saving the record further or deleting it. I hope this makes sense.

    Many thanks

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

    Re: Pre saving record (MS Access 2003)

    I don't understand your description, but if you use an AutoNumber field as primary key in each of the tables, you shouldn't have to worry about assigning a primary key - Access will do that automatically when the user starts entering data.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pre saving record (MS Access 2003)

    Sorry if I confused you. I was trying to add a record in the subform, save it, but refresh the form without losing the record in data entry mode. I needed to save the record to allow another part of the form to work (junction table) whilst still adding data to the record. I managed to get there by using the primary key value that was established after entering data in the first field and then after saving the record using a recordset/bookmark to get the subform back to the record the user was working with. Even I feel confused but it's sorted and working. Thanks again.

Posting Permissions

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