Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update subform for a new record 1

Status
Not open for further replies.

PaulCooper

Programmer
Jul 12, 2005
26
GB
I have a form, with a sub-form which works well.

When I add a new record, and add a new customer, (the first field to be entered) the sub-form does not update unless I move off that record and move back.

I am trying to make this happen by code. (The sub-form contains data that would help complete the rest of the main form so I would like it to update as soon as it "knows" who the customer is.)

I've tried doCmd.save (because I thought the sub-form/main-form link might not be working until the data became "hard"

then I tried this (cboCustomer is on the main form)
Code:
Private Sub cboCustomer_Exit(Cancel As Integer)
    Forms![frmAssets].Requery
End Sub
i.e. when you leave the customer picklist it requeries the sub-form to force an update.

and I get the error "Access cannot find the form frmAssets"

so I tried
Code:
Private Sub cboCustomer_Exit(Cancel As Integer)
    Forms([frmAssets]).Requery
End Sub
and get ther error "Type mismatch"

any pointers?

Regards
Paul
 
DoCmd.Save save the form design, not the edited record.
You may consider DoCmd.RunCommand acCmdSaveRecord

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
WOW

I've spent half a day on this and get the right answer in four minutes on this forum.

Tried it ~ it works

Thanks PHV ~ would never have found that myself. Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top