Update subform

D

Denver

I have a Form with a subform with control name
Data Entry2 subform

I set the AfterUpdate event in my Main Subform with this
code

DoCmd.Requery

because i have a cmdData Entry in this Form that opens my data entry Form.
i want that when i add new records thru my data entry form it displays
directly to the subform. can anyone is kind to help me? My DoCmd.Requery is
not working what else do i need to add in my codes? or im not using the
appropriate events?
how can i accomplish this?

thanks for any help.
 
M

Marshall Barton

Denver said:
I have a Form with a subform with control name
Data Entry2 subform

I set the AfterUpdate event in my Main Subform with this
code

DoCmd.Requery

because i have a cmdData Entry in this Form that opens my data entry Form.
i want that when i add new records thru my data entry form it displays
directly to the subform. can anyone is kind to help me? My DoCmd.Requery is
not working what else do i need to add in my codes? or im not using the
appropriate events?


Most DoCmd methods are not specific as to what they are
supposed to operate on. In you case I suspect it is
requerying the main form.

For a main form to explicitly requery one of its subforms
use something more like:

Me.[subform control name].Form.Requery

For one subform to explicitly requery another subform on the
same main form:

Parent.[subform control name].Form.Requery

For any form (main or sub) to requery itself:

Me.Requery

For any separate form to requery your main form:

Forms![name of your main form].Requery

For any separate form to requery a subform on your main
form:

Forms![name of your main form].[subform control
name].Form.Requery
 
D

Denver

Marshall Barton,

I have set my mainform (AfterEvent)
Me.[Data_Emtry2_subform].Form.Requery

for my subform (AfterEvent)
Me.Requery

but it doesnt function as i wanted it to work. when i try to add data it
does not
directly dispaly to my subform. I need to close the form and open again.
what else do i miss here or do i choose the wrong event procedure?

thanks for the help....


Marshall Barton said:
Denver said:
I have a Form with a subform with control name
Data Entry2 subform

I set the AfterUpdate event in my Main Subform with this
code

DoCmd.Requery

because i have a cmdData Entry in this Form that opens my data entry Form.
i want that when i add new records thru my data entry form it displays
directly to the subform. can anyone is kind to help me? My DoCmd.Requery is
not working what else do i need to add in my codes? or im not using the
appropriate events?


Most DoCmd methods are not specific as to what they are
supposed to operate on. In you case I suspect it is
requerying the main form.

For a main form to explicitly requery one of its subforms
use something more like:

Me.[subform control name].Form.Requery

For one subform to explicitly requery another subform on the
same main form:

Parent.[subform control name].Form.Requery

For any form (main or sub) to requery itself:

Me.Requery

For any separate form to requery your main form:

Forms![name of your main form].Requery

For any separate form to requery a subform on your main
form:

Forms![name of your main form].[subform control
name].Form.Requery
 
M

Marshall Barton

Denver said:
I have set my mainform (AfterEvent)
Me.[Data_Emtry2_subform].Form.Requery

for my subform (AfterEvent)
Me.Requery

but it doesnt function as i wanted it to work. when i try to add data it
does not
directly dispaly to my subform. I need to close the form and open again.
what else do i miss here or do i choose the wrong event procedure?


Assuming that "AfterEvent" means the **form** AfterUpdate
event.

If you are adding data to the main form, then:
Me.[Data_Emtry2_subform].Form.Requery
should requery the subform, but what do you expect to see
change in the subform's records? If you are changing a
linking field on the main form, then the subform control's
Link Master/Child properties should automatically resync the
subform records. If you are changing some other field on
the main form, why should anything in the subform need to be
requeried. IOW, why do you need to so a Requery?

I guess all that is supposed to convey that you need to
provide a lot more information about how the data in the
main form and subform interacts.

I have absolutely no idea why you would want the subform to
requery itself??
 

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

Similar Threads

Filter a subform 4
Comman Button 1
Syntax Error WHY? 16
Master form and subform 3
Cancel button to undo data on subform 13
populate to subform 3
Access Main form/Subform Navigation 0
Subform Blank? 3

Top