Requery subforms

J

Jasper Recto

I have a form that has not data source associated with it but has 2 subforms
embedded on it.

The form has 1 text box and 1 combo box where the user files in a part
number and a rev.

I have a button that is supposed to lauch a mcr that requeries the form.

However, nothing happens to the data. The subforms never get requeryed.

How do I link that button to requery the subforms?

Thanks,
Jasper
 
B

Bob Larson

If your main form doesn't have a record source then requerying will not do
anything. You will need to requery both subforms independently. You can
use this code (instead of a macro):

Me.YourSubformContainerName.Form.Requery
Me.YourSubformContainer2Name.Form.Requery

And you keep the Me part as it is a shortcut referring to the current class
object, which would be your main form where the button is located. And you
need to use the subform container name, not necessarily the subform name.
The subform container is the container control on the main form that houses
the subform on the main form.

And the .Form. part leave exactly as is.

See here for more about subforms and why the .Form. part is required:
http://www.btabdevelopment.com/main...rhowtoreferencesubforms/tabid/76/Default.aspx


--

Thanks,

Bob Larson
Access MVP
Administrator, Access World Forums
Utter Access VIP

Free Access Tutorials and Resources: http://www.btabdevelopment.com
 
R

Ron2006

You can also manually type into the Parent/master fields and the child
fields of the subforms themselves the values that link the subforms to
those fields.

Ron
 

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