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!

forms and subform requery problem 2

Status
Not open for further replies.

longestdrive

Programmer
Jan 23, 2007
26
GB
Hi

I thought I had worked all this out.

I'm trying to do a straightforward requery of subforms in a main form. I've used this method in the past but I just can't get it to work this time.

The process so far is the user adds a new record from a pop up form. When the user clicks a button on the dialog form it runs the following code:

'closes a dialog box
DoCmd.Close

'set focus back to main project form
Forms!frm_project.SetFocus

'requery project subforms
Forms!frm_project.frm_project_measuresSummary.Requery
Forms!frm_project.frm_project_MeasuresUpdate.Requery

I'm trying to requery the two underlying subforms but access throws up the error message:

'Application Defined or object defined error'

I've tried various methods but my hair is falling out now. I'm sure it's a simple error somewhere - I just can't see it.

Any advice?

Thanks
 
You may try this:
Code:
'requery project subforms
With Forms!frm_project!frm_project_measuresSummary.Form
  .RecordSource = .RecordSource
End With
With Forms!frm_project!frm_project_MeasuresUpdate.Form
  .RecordSource = .RecordSource
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Just tried your method and unfortuantely similar error.

I think the reason is that the script, which sits in the update form, is not referencing the project form correctly. How can I refer to a subform in another form from a dialog box which is closing?

I get in a mess with the referencing for forms and subforms as you can see!

Thanks
 
A similar helpful summary

[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]​
 
Excellent

Thanks for the references - I'll have a go today and check my references out

Thanks again
 
Just by way of an update - it was all down to syntax - referencing my subforms - thank you for your help.

I needed to use:
Forms!MainFormName!subFormName.Form.requery

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top