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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form requery not picking up latest data 1

Status
Not open for further replies.

longestdrive

Programmer
Jan 23, 2007
26
GB
Hi

I have an unbound form displaying record details, this has an underlying recordset and a combo control to enable the user to move through the records. This all works fine.
I have a button on the form for the user to add new records, it pops up a form and the user enters the details, this form is bound to a table and works fine.
The form then closes. Before it closes I then requery the view form and expect to see the combo box updated with the new record but it doesn't update.

Here's the code from my new record form as it closes:
Code:
    ' save this record first
    DoCmd.Save , "frm_new_assessment"
 
    [Forms]![frm_viewAssessments].Form.Requery
    [Forms]![frm_viewAssessments].[Form]![cbo_userAssts].Requery
    Debug.Print ("user asst requery")
    
    DoCmd.Close

It appears as if the records this form creates does not get 'saved' to it's table until the form is closed completely even though I have saved the form earlier and so as the records aren't there nothing changes on my view form.

I tested this with a break at the requery and the records did not yet exists.

So - some help please.

1. At what point should I requery my view form to ensure the records are there?
2. Why does the save not save the records until the form is closed completely
3. How can I pause code on my calling form until the view form is closed - thinking that once the view form gets control again I can refresh there (change my form to a function??)

Any advice appreciated

Thanks
 
Aghhhh

FOund one part of my problem - a bit more reading and googling. My docmd.save just saves the form not the record so I'm going to use

RunCommand acCmdSaveRecord

Which now works. YAY

But...How can I pause code on one form while another form is open and then resume when that other form closes?

Thank you
 
Open your another form as modal.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top