Hi! I need help with comboboxes, listboxes...

Keidy

Registered User.
Local time
Today, 17:41
Joined
Dec 5, 2006
Messages
26
I have a form with many combo and list boxes, but i don't know how to find a relation between them. I want to select a name of a product that is in a combobox and then a list or text box will show its description.... Please help me because I will burn out sooner or later :eek:
KD:confused:
 
You need to use the After Update event of the combobox to update your listbox.
 
Search for "cascading ComboBoxes" there are many examples posted.

Col
 
Comboboxes

KeithG said:
You need to use the After Update event of the combobox to update your listbox.
yes that's what i want, but i dont know how
I have to do it in VB
 
You will have to change the Row source of the list box to only show description for the product choosen in the combobox
 
The simplest way is to have your listbox have an underlying query as it's rowsource and in the query have the criteria be the combo box. Then, you just go into the combo box's AfterUpdate event (done by selecting the combo box in design view, clicking on the Event tab in the properties dialog, and selecting EVENT PROCEDURE in the dropdown that appears when you click inside empty box to the right of the words "AfterUpdate" event in the list, and then clicking on the elipsis [...] that appears to the right of that box you just selected EVENT PROCEDURE) and enter
Code:
Me.TypeYourActualListBoxNameHere.Requery
And, just as an FYI, the key word ME is a shortcut in code that refers to the current form that you are on, so in the event for the list box it refers to the form that the list box is on.
 
Ok let me explain my problem

boblarson said:
The simplest way is to have your listbox have an underlying query as it's rowsource and in the query have the criteria be the combo box. Then, you just go into the combo box's AfterUpdate event (done by selecting the combo box in design view, clicking on the Event tab in the properties dialog, and selecting EVENT PROCEDURE in the dropdown that appears when you click inside empty box to the right of the words "AfterUpdate" event in the list, and then clicking on the elipsis [...] that appears to the right of that box you just selected EVENT PROCEDURE) and enter
Code:
Me.TypeYourActualListBoxNameHere.Requery
And, just as an FYI, the key word ME is a shortcut in code that refers to the current form that you are on, so in the event for the list box it refers to the form that the list box is on.

ok i have to boxes
the first one is a combobox where i have some plants like LGN, UREA etc
and the other one is a listbox where i have some equipments and their descriptions of each one. i want that when i select LGN on the combobox the listbox have to show the equitments and the descriptions that belongs to that plant and when you select urea on the same combobox the listbox will show the equipments and descriptions of that plant
 
listbox

I am trying to follow the example below, when trying to to this

"The simplest way is to have your listbox have an underlying query as it's rowsource and in the query have the criteria be the combo box."

I get the message "error in from clause"

Can anyone see what is wrong with my statment

SELECT Qry_Delivered.[Cylinder Number], Qry_Delivered.[Cylinder Barcode Label] FROM Qry_Delivered =Form!Qry_Delivered1!Person;
 
Not sure where you are using that SQL statement because if you build the query using the QBE it is actually easier as it puts the correct thing in there if you put your mouse in the criteria area of the field you want and then click on the Expression Builder, navigate to your form and then the control and doubleclick and it puts it in there. But, if you are building the SQL statement yourself in the SQL window change it to:
Code:
SELECT Qry_Delivered.[Cylinder Number], Qry_Delivered.[Cylinder Barcode Label] FROM Qry_Delivered = Forms!Qry_Delivered1.Person;
 
I also managed to get this working in my database. however, it only works on an individual form. when i try to incorporate the form with this function as a subform of another form, it no longer works. what adjustments do i need to make?
 
The syntax for referring to a control on a subform, from code outside of the subform, is:
Code:
Forms!YourMainFormNameHere.YourSubFormNameHere.Form.YourControlNameHere

To refer to a control on a subform from code within the subform:
Code:
Me.YourControlNameHere

To refer to the main form from code in the subform:
Code:
Forms!YourMainFormNameHere.YourControlNameOnMainFormHere
 
where do i need to put this stuff?

thanks, but im not sure if my question is being answered, or maybe i don't know my question lol. let me try to clarify; when I open up my individual form (the form being my 'Contracts' form) with this function, everything from the query posted here works; selecting a person's a name from a combo box successfully populates a list box meant to display their phone numbers.

however, when I try to open a form with this 'Contracts' form as a subform (which I had previously setup), the system now prompts me to enter in a parameter for my list box (which refers to the combo box where I select names). Does this help at all? Thanks in advance for your time, I really appreciate it.
 

Users who are viewing this thread

Back
Top Bottom