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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

programming listboxes

Status
Not open for further replies.

Lourry

Technical User
Jul 25, 2003
84
CA
I have a database table in Oracle and I am creating a form in Access to basically read the information and perhaps add new records. In the Oracle table, there is a field called Status and it stores the index number of the selected value of a listbox.

For example:

Project | Status
A | 0
B | 3
C | 1
D | 2
. | .
. | .


I created a listbox called lstStatus on a form and bound the listbox to the Status field in the Oracle table. When I go through the records using the form, say starting at the beginning of the dtabase. The listbox will have no reaction (Nothing is selected)
I have entered the values in the listbox in the following order "Requested";"In-Progress";"Cancelled";"Completed" and it is showing up properly.

My question is.....is there a way to code the listbox so that if it gets a "0" from the Oracle table then it will refer to the value that has a listIndex of 0 which is "Requested" and highlight "Requested" in the listbox??

Example:
For the first record: on the form, the listbox will have "Requested" highlighted, the second record will have "Completed" highlighted...etc

Please help as I am really desparate!
Thanks again for everyone that is reading this post.
-Lory
 
The easist thing to do would be to create another table that the list box will get it's values from:

tblStatus
Value - Status
0 - Requested
1 - In Progress
2 - Cancelled
3 - Completed

The list box would be bound to the oracle table that you are working with.

The source of your list box would be:

SELECT * FROM tblStatus

Column count would be 2, bound column would be 1. If you want to display the "Value" then column widths would be something like .1";1" If you want to hide the Value column widths would be something like 0";1"

Now as you scroll through records the correct status should be displayed. You can do the same thing with a combo box which would function the same way but not display all the other choices all the time, just when you "pulled it down
 
Thanks dcurtis!!

THanks for replying so soon too! It works perfectly. Thank you so much : )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top