Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

synchronized combo boxes not working when subform

Status
Not open for further replies.

sandbolt

Technical User
Nov 3, 2004
6
US
I have a form with synchronized combo boxes in a subform. They work when I open the subform by itself to enter data.

When I open the main form, then tab down to the subform, the second combo box does not get updated. I get prompted for the value in the first combo box; as if the query cannot read the value off the form.

Anyone know why there would be a problem when opening the main form, but not when I only open the subform?

Thanks in advance.
 
Any chance you could post the value of the RowSource property of the combo and (if applicable) the code modifying it ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
RowSource:qryHVECustNum

This is the query:

SELECT DISTINCT tblBillingData.[CUSTOMER NUMBER], tblBillingData.CUSTOMER
FROM tblBillingData
WHERE (((tblBillingData.CUSTOMER)=[forms]![frmHVESub]![Customer]) AND ((tblBillingData.ACCOUNT)="452470" Or (tblBillingData.ACCOUNT)="452471"));


I tried changing the where condition to:
[forms]![frmHVEMain]![frmHVESub]![Customer]
I no longer get prompted for the value, but the combo box is blank.

Thanks.
 
Replace this:
[forms]![frmHVEMain]![frmHVESub]![Customer]
By this:
[forms]![frmHVEMain]![frmHVESub].Form![Customer]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Another way is to dynamically populate the 2nd combo in the AfterUpdate event procedure of the 1st:
Me![2nd combo name].RowSource = "SELECT DISTINCT [CUSTOMER NUMBER],CUSTOMER FROM tblBillingData" _
& " WHERE CUSTOMER='" & Me!Customer & "' AND ACCOUNT IN ('452470','452471')"
Me![2nd combo name].SetFocus
Me![2nd combo name].DropDown

If CUSTOMER is defined as numeric in tblBillingData then get rid of the single quotes surrounding Me!Customer

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for all of your help. Didn't get a chance to try it, but will soon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top