Requery forms

dcjones

Dereck
Local time
Today, 20:07
Joined
Mar 10, 2004
Messages
108
Hi All.

I have been reading a earlier post regarding requerying forms


Forms are displayed on other form by means of a SubFormControl. It is the name of the SubFormControl that is needed. This is often the same as the SubForm but it is *not* a requirement. In your case you will be using two SubFormControl names, one nested within the other. Just for the record, you Requery forms and not fields.

How do you find out the name of the SubFormControl. I am trying to refresh sub forms and I am trying to use the following code.

Private Sub Form_AfterUpdate()
Forms!MainFormName!SubFormControl.Form!SubSubFormC ontrol.Requery
End Sub

I have 2 forms, "frmMainClient" and a subform "frmjob" and I have a command button on the "frmJob" which brings up a pop up form " frmJobNew". I fill out the fields and save via a command button.

When I look at the "frmJob" the new record I have entered is not there. It is there if I close all the forms and then open them again.

I know I need to requery the forms but I am not too sure how this is done.

Many thanks in advance.
 
Resolved

All done,

On the "frmJobReadOnly" form save button I used the following. Work fine.

Private Sub Command17_Click()
On Error GoTo Err_Command17_Click


DoCmd.Save
DoCmd.Close
Forms!frmMainClient![frmJobReadOnly].Form.Requery


Exit_Command17_Click:
Exit Sub

Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom