Requery SubForm

L

Larry Salvucci

I have a subform that is filtered by a combo box on my main form. The combo
box allows the users to select a year and then all the records within that
year will appear on the subform. I have the default of my combo box set to
"Year(Date())" so when the form is opened it will already show the records
for the current year. I also have some textboxes on my main form the do some
calculations based on the records on my subform. The problem is that when I
open the form and there are records on the subform the calculation controls
will not calculate until I select a year in the combo box. There is a value
already in the combo box based on the default that I set. How come these
calculations won't calculate since there is data already filtered on my
subform when I open my main form? The only way they will calculate is if I
select the year again even though it's already set with a default.
 
J

Jeanette Cunningham

Larry,
this often happens when we use default values.
If you have code on the after update event of the combo, you can try putting
code like this in the form's load event
Call Me.TheComboName_AfterUpdate

Jeanette Cunningham
 
L

Larry Salvucci

Hi Jeanette,

I just tried it and now I'm getting a compile error: Invalid use of property.

Here's what I put on the load event:

Call Me.cboYearSelect.AfterUpdate
 
J

Jeanette Cunningham

If you do have an after update event for cboYearSelect
change the . between cboYearSelect and AfterUpdate to
an underscore like this:
cboYearSelect_AfterUpdate

You can find the sub for the after update and copy the relevant part of its
first line, then just put Call followed by a space in front of it.

Jeanette Cunningham
 
L

Larry Salvucci

That didn't work either. Now I'm getting a "Method or data member not found"
message.

This is what tried this time:

Call Me.cboYearSelect_AfterUpdate
 
L

Larry Salvucci

I forgot to take the "Me." out of the line. Now it works. This is what I used:

Call cboYearSelect_AfterUpdate

Thanks for your help!
Larry
 

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