Save changes from popup to existing record in subform

  • Thread starter Penny via AccessMonster.com
  • Start date
P

Penny via AccessMonster.com

I have a form with a subform on it. When I click on the edit button on the
subform item row, a pop up is shown with data prepopulated from the datasheet
subform. I make my edits and then click save to save my changes to the
subform, but it creates a new line item on my subform. Please, what am I
doing wrong? How can I save just to that record that I'm editing in the
popup without creating an additional line item in my subform?

I'm using the following to save the record from the popup:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Thanks,
Penny
 
A

Albert D. Kallal

You should only need one, perhaps two lines of code to make this ALL work.

you pop form simply need be bound to the same table as the sub-form.

Simply go:

' first, write out the record
if me.Dirty = true then
me.dirty = false
end if

now, open up pop up for to the same current record

docmd.OpenForm "myEditDetailsFormThatPopsUp",,,"id = " & me!id


That is it...when you close the popup form, all the data will be written to
the table. You don't need much code other then the above...

Just make sure the details form is not opened in add mode (and, you should
turn off navagation keys etc.).
 
P

Penny via AccessMonster.com

Thank You! Works like a charm
You should only need one, perhaps two lines of code to make this ALL work.

you pop form simply need be bound to the same table as the sub-form.

Simply go:

' first, write out the record
if me.Dirty = true then
me.dirty = false
end if

now, open up pop up for to the same current record

docmd.OpenForm "myEditDetailsFormThatPopsUp",,,"id = " & me!id

That is it...when you close the popup form, all the data will be written to
the table. You don't need much code other then the above...

Just make sure the details form is not opened in add mode (and, you should
turn off navagation keys etc.).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top