UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Cascading Combo Box On Continious Form Displays Incorrect Data, Access 2013    
 
   
oxicottin
post Sep 10 2019, 09:56 PM
Post#1



Posts: 739
Joined: 29-May 07
From: West Virginia, United States


Hello, I have a continuous subform that has two combo boxes. The first is just a combobox (cboComponent) that I make a selection then the second combo (cboComponentParts) is based on the first. For the Row Source of the second combo I am using.

QUOTE
SELECT tbluComponentData.Part, tbluComponentData.IsInactive
FROM tbluComponentData INNER JOIN tbl_Components ON tbluComponentData.Component = tbl_Components.Component
WHERE (((tbl_Components.ComponentID)=[Forms]![frm_UpdateProductComponentsParts]![sfrm_UpdateProductComponentsParts].[Form]![cboComponent]))
GROUP BY tbluComponentData.Part, tbluComponentData.IsInactive
HAVING (((tbluComponentData.IsInactive)=False));


Now, here is what happens. In the continuous forms first record I select a (cboComponent) and then the (cboComponentParts) populates that correct data so I go to record two and do the same thing and it works correctly. Now here is where it gets messed up, if I decide I want to change just the (cboComponentParts) from the first record it displays the data that would be for the second record and the only way to get it to change is if I change the (cboComponent) then the (cboComponentParts) will again display the correct data.

Now here is something else, I created a query (Query1) with the exact SQL from above and then opened the form and its subform and clicked on a record and then opened the Query1 and it always displayed the correct data but the combo box didn't?

What do I need to do to fix this? Thannks!
Go to the top of the page
 
oxicottin
post Sep 10 2019, 10:19 PM
Post#2



Posts: 739
Joined: 29-May 07
From: West Virginia, United States


Ok, after days of dealing with this I just ran across an example that fixed my issue. (txtComponentParts) is a textbox that displays the data sitting on top my (cboComponentParts).

CODE
Private Sub txtComponentParts_GotFocus()
DoCmd.GoToControl "cboComponentParts"
End Sub

Private Sub cboComponentParts_Enter()
Me.cboComponentParts.Requery
End Sub

This post has been edited by oxicottin: Sep 10 2019, 10:20 PM
Go to the top of the page
 
BruceM
post Sep 11 2019, 07:47 AM
Post#3


UtterAccess VIP
Posts: 7,968
Joined: 24-May 10
From: Downeast Maine


You can requery the combo box without going to it. Typically a cascading combo box is requeried when a selection is made in the previous one. For instance, if you have States and Counties, the list of counties would be updated when a state is selected, in the After Update event of the State combo box. Another consideration may be that you need to set the combo box row source in the Current event, so that if a State is already selected the list of Counties will match the State.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th October 2019 - 02:59 AM