New records don't display correctly in subforms after save.

P

Peter Stone

Access 2003, XP Pro

I have a main form with two separate subforms. I view various records by
clicking on some list boxes.

To add a new record, I select Records, Data Entry.

I then
(1) Make a selection in a combo on the main form.
(2) Make a selection in a combo and enter some text in a textbox on subform1
(3) Make a selection in a combo on subform2

Subform2 has some code on the After Update event that saves the new record
and goes to a previously selected record in cbo1 on the main form (cbo2 has
code on the After Update event to go to that record).

Here's the code on subform2
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

Me.Parent.Requery
Me.Parent!subform1.Form.Requery
Me.Requery

Me.Parent!cbo2= Me.Parent!cbo1

Me.Parent.Refresh
Me.Parent!subform.Form.Refresh
Me.Refresh

The problem is the main form then displays the correct record, but the two
subforms remain blank until I close and reopen the form.

I have also tried solutions without code just by clicking to another record,
but then the main form once again displays the correct record, but then the
subforms display the new data and won't refresh until I close and reopen the
form.

Thank you

Peter
 

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