Subform controled by combo box will not requery

jetersauce

Registered User.
Local time
Today, 02:15
Joined
Dec 21, 2010
Messages
20
I'm having a problem with a subform that will not requery.

The subform is a datasheet that pulls price records based on a combo box in the main form. The query for the subform is as follows
Code:
SELECT AFL_CustomerPrices.Matrix, AFL_CustomerPrices.Test, AFL_CustomerPrices.Method, AFL_CustomerPrices.Priority, AFL_CustomerPrices.Price, AFL_CustomerPrices.CustomerID
FROM AFL_CustomerPrices
WHERE (((AFL_CustomerPrices.CustomerID)=[Forms]![AFL_CustomerPrice]![cboCustomerID]));

I then have the following VB code for the CustomerID combo box
Code:
Private Sub cboCustomerID_AfterUpdate()
Me.AFL_CustomerPrice_subform.Form.Requery
End Sub

Selecting a CustomerID in the combo box will not cause the subform to populate the price data on its own.

HOWEVER, if I save a new price record under a CustomerID and THEN select that customer from the combo box, it pulls the query like it should. This is a problem because employees need to see the list of test prices per CustomerID without having to save a bogus record in order to have the query work.

Any help with this would be greatly appreciated.
 
Are you absolutely sure that the control on the main form that houses the subform is really named AFL_CustomerPrice_subform? You need to use the name of the control that houses the subform and not the name of the subform itself, unless both the subform control and the subform share the exact same name.

Also, does your name have the underscores or are they really spaces?
 
Where would I check to see the name of the control that houses the subform (sorry I'm self taught)?

Yes they are underscores and not spaces.
 
I checked and they both are named AFL_CustomerPrice_subform

CF0CJ.png


Why would it work after adding a record but not before?
 
Is there anything else I should look at? The form is still not working properly.
 
Is there anything else I should look at? The form is still not working properly.

My only other suggestion is to post a copy of your database here (if split, both the frontend and backend) with BOGUS data in it (don't leave real data there).

You would need to first run COMPACT AND REPAIR and then after that is done, right click on the file and select SEND TO > COMPRESSED FOLDER to zip it up and then post the zip file. The final zip file has to be at, or under, 2Mb (which should be possible if you remember to compact and repair first and then zip).
 

Users who are viewing this thread

Back
Top Bottom