requery subform

Sade

Board Regular
Joined
Nov 29, 2004
Messages
145
Hello. I have a date field on a subform that is defaulted to the date field on the main form. When I change the main form's date, I want the subform's date to change as well.

To do this I am using the "requery" command in the "on change" event property of the main form's date field. When I open the forms, the defaults all work, but when I change the date on the main form, the subform requeries to show the data that is in it's table, not the new date value on the main form. Is there a better option than requery?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
When you say that that the subform is defaulted to the main form date field, how is it defaulted? Is it a simple expression like
Code:
 =[myMainForm].[dateField]

What you should be able to do is reference the control on the subform (I am assuming that you are showing it in form view and not datasheet or something else) like this:
Code:
 Me![mySubform].Form!mySubformControl.Value = myMainFormControl.Value

This would go in the After Update or Lost Focus event, or however you want to do it.

For some good reading and reference, this is my go-to guide on how to talk between forms:
http://access.mvps.org/access/forms/frm0031.htm

Let me know if this helps.
 
Upvote 0
You nailed it! Thats exactly what I was doing, and your code did the trick. Thanx a ton!
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top