473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Combo box activate a listbox

36
Hi Gente,

I need to Know how I can activate a list box value with combo box after update function. example I have a combo box if i chosse any in list from combo box then activate a list box "like on_click" selecting the last autonumber ID in this list box.

¿How? Masters!

Thanks for any Ans.... Gracias!!!
Aug 6 '07 #1
16 2973
MMcCarthy
14,534 Expert Mod 8TB
I'm not sure from your question exactly what you are doing but have a look at this tutorial and see if it helps.
Aug 6 '07 #2
ElTipo
36
I'm not sure from your question exactly what you are doing but have a look at this tutorial and see if it helps.
Thanks for your Answer but its not a Cascading Combo box Im not sure.

OK, If I select a value in combo box then go to my list box and select the last autonumber record. Like activate the function for my list box and Automatic chose the last record in list box.
Aug 7 '07 #3
Scott Price
1,384 Expert 1GB
Your questions aren't clear enough at this point to be able to help out.

If you would be more comfortable in spanish, I can try to help out with your question, or if I can't answer it I can translate so one of the experts CAN answer it.

What is the name of your combo box, what is the name of the list box, and what is the data represented in each?

Regards,
Scott
Aug 7 '07 #4
ElTipo
36
Your questions aren't clear enough at this point to be able to help out.

If you would be more comfortable in spanish, I can try to help out with your question, or if I can't answer it I can translate so one of the experts CAN answer it.

What is the name of your combo box, what is the name of the list box, and what is the data represented in each?

Regards,
Scott
Hi Scott

My Combo box is cbobranch and my list box is lstRates I need to select any branch in my cbobranch then my list box lstRate select automatic the recently Rate in table. The user only click any value in cbobranch and the lstRate choose the the ultimate rate entry.

Hola Scott
Mi combo box es cbobranch y mi list box es ldtRates cuando seleccione una sucursal en mi combo box automaticamente se activa el list box lstRates. El usuario no necesita hacer click en el lstRates.


Sorry for my english.

Thanks for your time.
Aug 7 '07 #5
Scott Price
1,384 Expert 1GB
De nada por cualquier ayuda que puedo ofrecerle...

¿Qué es la estructura de su forma? ¿Es basada en un 'query', o en un 'table'?
¿En su combobox, es cada branch associada con solo un valor en su listbox?
¿Qué es la estructura de su combobox y listbox? Por ejemplo, para hacer funcionar lo que está tratando de hacer, tiene que tener 2 columnas en cada control, la primera columna debe ser el numero de identificación. La primera columna puede tener una anchura de 0" para que no pueda verla.

A mi parecer, no tiene que usar un 'listbox' por lo que está tratando de hacer, un 'textbox' sería suficiente.

Mis pensamientos en este momento, sin saber las respuestas de mis preguntas arriba, es que tiene que basar su forma en un query que jala los valores necisarios. En su query, en el campo 'criteria' debajo de su campo Rates, entre este: Forms![NombreDeSuForma].cboBranch

Su combo box no tiene que ser 'bound' (pegada) a ningun campo en su query, pero el textbox o listbox si, tiene que ser pegada al campo Rates de su query. Suficiente para su combo box tener en el 'Row Source', algo semejante a:
Expand|Select|Wrap|Line Numbers
  1. Select BranchID, Branch From tblBranch
Despues, entre este codigo en el evento "AfterUpdate" de su cboBranch: (en ingles :-)

Expand|Select|Wrap|Line Numbers
  1. Me.Requery
Y, su ingles está bien...

Ojalá que este sea de ayuda...

Regards,
Scott
Aug 7 '07 #6
Scott Price
1,384 Expert 1GB
I will happily translate this post into English to avoid running afoul of the general posting guidelines, as well as to be helpful to anyone else who is browsing this forum!

The general reply I gave is:

What is the structure of your form? Is it based on a query or a table? In your combo box, is each branch associated with only one value in your listbox? What is the structure of your combobox and listbox? For example, to make what you are trying to do work, you need to have two columns in each control, the first column should be the ID number field, and only needs to have a width of 0", so you don't have to see the numerical value in it.

I don't think you need to use a listbox for what you are trying to do, a textbox should be enough.

My thoughts at this moment, without knowing the answers to my questions above, is that you need to base your form on a query that pulls the needed values. In your query, in the criteria field below your Rates field, enter this: Forms![YourFormName].cboBranch...

Your combobox can be unbound, but your text/listbox needs to be bound to the Rates field of your query. It should be enough for your combo box to have it's Row Source setting something like this:
Expand|Select|Wrap|Line Numbers
  1. Select BranchID, Branch From tblBranch
Then, enter this code in the AfterUpdate event of your cboBranch:

Expand|Select|Wrap|Line Numbers
  1. Me.Requery
Scott
Aug 7 '07 #7
Scott Price
1,384 Expert 1GB
Disculpe,
Expand|Select|Wrap|Line Numbers
  1. Forms![NombreDeSuForma].cboBranch
tiene que estar en el campo criteria debajo de BranchID en su query.

Excuse me,
Expand|Select|Wrap|Line Numbers
  1. Forms![YourFormName].cboBranch
needs to go in the criteria field under your BranchID field in your query.


Regards,
Scott
Aug 7 '07 #8
ElTipo
36
Disculpe,
Expand|Select|Wrap|Line Numbers
  1. Forms![NombreDeSuForma].cboBranch
tiene que estar en el campo criteria debajo de BranchID en su query.

Excuse me,
Expand|Select|Wrap|Line Numbers
  1. Forms![YourFormName].cboBranch
needs to go in the criteria field under your BranchID field in your query.


Regards,
Scott
Hi Scott, Thanks for your time, my answers is under line for your Q?

Q. What is the structure of your form?
- Is a single form
Q. Is it based on a query or a table?
- Is based on a query, include tblbranch, tblEmployees, tblRates & the many table tblCharges. The branch & Employee tables are related with tblCharges. but the tblRate is not related.
Q. In your combo box, is each branch associated with only one value in your listbox?
- The combo box it obtains the info. for tblbranch. The combo box have branchID & list the name of branches 2 columns. The branchID is related with branchID field in the many tblCharges. if I choose the first name branch then the branchID resgistered in the many tblCharges.
- My list box have 7 columns RateID its included in the 7 but the user no see this field. Only see the numbers of fields rates ex. 10, 0.08 etc..and the field date for any change in the rate.

I put the criteria in a query - Forms![YourFormName].cboBranch under branchID
and Me.Requery afterupdt in cbobranch. But not function. My list box can't activate. My combo box after updt can't select in the list box the last rate that user entry.

Any other info. for your great help as need ask me...

Thanks Again
Aug 7 '07 #9
Scott Price
1,384 Expert 1GB
Hi Scott, Thanks for your time, my answers is under line for your Q?

Q. What is the structure of your form?
- Is a single form
Q. Is it based on a query or a table?
- Is based on a query, include tblbranch, tblEmployees, tblRates & the many table tblCharges. The branch & Employee tables are related with tblCharges. but the tblRate is not related.
Q. In your combo box, is each branch associated with only one value in your listbox?
- The combo box it obtains the info. for tblbranch. The combo box have branchID & list the name of branches 2 columns. The branchID is related with branchID field in the many tblCharges. if I choose the first name branch then the branchID resgistered in the many tblCharges.
- My list box have 7 columns RateID its included in the 7 but the user no see this field. Only see the numbers of fields rates ex. 10, 0.08 etc..and the field date for any change in the rate.

I put the criteria in a query - Forms![YourFormName].cboBranch under branchID
and Me.Requery afterupdt in cbobranch. But not function. My list box can't activate. My combo box after updt can't select in the list box the last rate that user entry.

Any other info. for your great help as need ask me...

Thanks Again
1. Does each branch have a particular rate associated?

2. Or are you trying to simply have a rate display in the list box according to the latest dated rate?

If #1, then in order to have your cboBranch affect your list box Rates, you will have to relate the two tables in your query in some way.

Please post the sql code behind this query... (go into query design view, right click on the top of the query window, choose sql view, and copy/paste to a reply here.)

Where does your listbox get its data from? Is it from a separate query, or is it pulling from the same query as your main form?

If #2, I'll need to know more about your listbox, such as it's row source property, etc...

You're doing quite well in English so we continue without the Spanish for the moment... If needed we can switch :-)

Regards,
Scott
Aug 8 '07 #10
ElTipo
36
1. Does each branch have a particular rate associated?

2. Or are you trying to simply have a rate display in the list box according to the latest dated rate?

If #1, then in order to have your cboBranch affect your list box Rates, you will have to relate the two tables in your query in some way.

Please post the sql code behind this query... (go into query design view, right click on the top of the query window, choose sql view, and copy/paste to a reply here.)

Where does your listbox get its data from? Is it from a separate query, or is it pulling from the same query as your main form?

If #2, I'll need to know more about your listbox, such as it's row source property, etc...

You're doing quite well in English so we continue without the Spanish for the moment... If needed we can switch :-)

Regards,
Scott
Yea number 2, the first field in the list box like "column" is DateChangeRt. Its better for the user to know what is the correct rate for any branch to choose.

Only display rates but the user select the correct for any branch right now. I desire to avoid that the user select rate is not exiting any change for any branch.

My cbobranch is:

SELECT tblBranch.BranchID, tblBranch.BranchName FROM tblBranch ORDER BY tblBranch.BranchName;

My lstRate is:

SELECT tblRate.RateID, tblRate.DateChangeRt, tblRate.NofixedRt, tblRate.QuantityRt, tblRate.SchgRqtRt, tblRate.SchgSpeRqtRt, tblRate.SchgSaRt FROM tblRate;

thanks scott
Aug 8 '07 #11
Scott Price
1,384 Expert 1GB
You didn't specifiy, but assuming that your list box is based on this query in it's Row Source field

SELECT tblRate.RateID, tblRate.DateChangeRt, tblRate.NofixedRt, tblRate.QuantityRt, tblRate.SchgRqtRt, tblRate.SchgSpeRqtRt, tblRate.SchgSaRt FROM tblRate;
To show ONLY the latest changed record, you can change it to this:

SELECT tblRate.RateID, tblRate.DateChangeRt, tblRate.NofixedRt, tblRate.QuantityRt, tblRate.SchgRqtRt, tblRate.SchgSpeRqtRt, tblRate.SchgSaRt FROM tblRate WHERE tblRate.DateChangeRt = DMax ("[DateChangeRt]", "tblRate");

This will return only one row in your list box, the row with the latest date...

Not sure if this is really what you are looking for, but it is actually the most efficient way of displaying the data you are asking for (as I understand your request).

Regards,
Scott
Aug 8 '07 #12
ElTipo
36
You didn't specifiy, but assuming that your list box is based on this query in it's Row Source field



To show ONLY the latest changed record, you can change it to this:

SELECT tblRate.RateID, tblRate.DateChangeRt, tblRate.NofixedRt, tblRate.QuantityRt, tblRate.SchgRqtRt, tblRate.SchgSpeRqtRt, tblRate.SchgSaRt FROM tblRate WHERE tblRate.DateChangeRt = DMax ("[DateChangeRt]", "tblRate");

This will return only one row in your list box, the row with the latest date...

Not sure if this is really what you are looking for, but it is actually the most efficient way of displaying the data you are asking for (as I understand your request).

Regards,
Scott
Hi Scott,

The instruction code its work in the list box but for I need no.

I need that the "listbox" activate for "Default" the last one "Record" but that the user have option to choose some previous. When the "Combo box" be selected be activated the "list box" like "on click" function. The "list box" is not still selected. The "list box" it should activate after update in combo box.

Necesito que el "list box" active su función en el "record" más reciente pero que el usuario no tenga que hacerlo "On Click". Este debe activarse luego de seleccionar el "Combo box".

Thanks for your time....
Aug 8 '07 #13
Scott Price
1,384 Expert 1GB
Hi Scott,

The instruction code its work in the list box but for I need no.

I need that the "listbox" activate for "Default" the last one "Record" but that the user have option to choose some previous. When the "Combo box" be selected be activated the "list box" like "on click" function. The "list box" is not still selected. The "list box" it should activate after update in combo box.

Necesito que el "list box" active su función en el "record" más reciente pero que el usuario no tenga que hacerlo "On Click". Este debe activarse luego de seleccionar el "Combo box".

Thanks for your time....

In the AfterUpdate event of your combo box, set the focus to your list box with this line of code:
Expand|Select|Wrap|Line Numbers
  1. Me![YourListBoxName].SetFocus
In the GotFocus event of your listbox you will need to do a recordset/bookmark. You can try writing the code yourself, looking in MS Access help file for the syntax. I've got a snippet of code I'm working on at the moment, but won't post it yet because it's not behaving correctly in my test db... I only mention this for reference purposes, and so you can get a jumpstart on understanding the concept of what we're trying to do.

[Added Idea] You can, as another idea, change the RowSource of the list box to this:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblRate.RateID, tblRate.DateChangeRt, tblRate.NofixedRt, tblRate.QuantityRt, tblRate.SchgRqtRt, tblRate.SchgSpeRqtRt, tblRate.SchgSaRt FROM tblRate; ORDER BY tblDate.DateChangeRt DESC; 
This will place the latest dated record as the first record listed in your listbox.

Back Soon!
Regards,
Scott
Aug 8 '07 #14
Scott Price
1,384 Expert 1GB
If instead of ordering the list box by descending date, as in my previous post have a look at this thread, where I got help from JKing to debug the select record in listbox function...

http://www.thescripts.com/forum/thread689835.html

Regards,
Scott

p.s. please post back to let us know if you've got it working!
Aug 8 '07 #15
ElTipo
36
If instead of ordering the list box by descending date, as in my previous post have a look at this thread, where I got help from JKing to debug the select record in listbox function...

http://www.thescripts.com/forum/thread689835.html

Regards,
Scott

p.s. please post back to let us know if you've got it working!
Hi Scott

Ok, the setfocus vb work like this, afterupdate in combo box the list box get focus correct but no activate the list box function like On_Clik. OK I try to insert an image in this post for better explain and view the example but I don't know how.

it will continue playing with the code....
Aug 9 '07 #16
Scott Price
1,384 Expert 1GB
Hi Scott

Ok, the setfocus vb work like this, afterupdate in combo box the list box get focus correct but no activate the list box function like On_Clik. OK I try to insert an image in this post for better explain and view the example but I don't know how.

it will continue playing with the code....
Make sure to go to the end of the thread in order to get the correct code!

If you continue having problems, post the code you are using, including any changes you have made to it...

Regards,
Scott
Aug 9 '07 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Scott | last post by:
I have an ASP page which show's a Drop-Down Combo box, and a ListBox. My Combo Box is populated from a SQL Select Statement which shows User Groups. I want to populate my Listbox with all the...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
2
by: Inquiring_Mind | last post by:
i am creating a database. i have the following question.. as per the specs... i need to be able to pull other forms from the master form using either a list or a combo box. what is the...
7
by: Hans Merkl | last post by:
Hi, Can anybody recommend a combo box control (textfield + dropdown list) for ASP.NET? I have looked at some products and it seems they all have some problems. I haven't yet found a combo box...
7
by: Amanda | last post by:
User is going to be transferring items out of combobox to listbox and vice versa keeping ascending and desending order respectively at all time. If user selects the last item in combobox, the...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
14
by: rdade22 | last post by:
I have a combo box (cboStore) and a listbox (Qlist) both are unbound to a form call frmFAQ. What I want is to be a able to select a Subject from the combo box and have the results show up in the...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
by: dudeja.rajat | last post by:
On Sat, Aug 30, 2008 at 2:32 PM, Fredrik Lundh <fredrik@pythonware.comwrote: Fredrik, Thanks so much. That worked. Following this, I can now see that my combo2 has no previous elements and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.