Hello.
As far as I know, in order to do this, you will have to use multiple text boxes on the same form to imitate the list box.
So, say for example you have a table with a list of items that your shop sells. You may have the following table structure :
ItemID
Item Description
Unit Price
No In Stock
What we want to do here is change the back color of "No In Stock" to Red if there are none left (usually would be set when goes beyond re-order level)
1. Ok, so you create a block of 4 text boxes accross by 20 down.
ID Description Price Qty
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
|----||---------------------------------||------||--|
2. Ok, so name each of these text boxes txtID1, txtDescr1, txtPrice1, txtQty1 (next row) txtID2, txtDescr2, ... etc ... txtQty20
So now add your own record selector buttons to the form. You must now write a function which gets any specific line from the table/query, and collects the data for each row.
In order to do this, you will need to create a datatype called "ItemRow" to capture the info once the function is called (as you cannot return more than 1 value in a function!).
The function definition would look like :
Public function getRowItem(Byval rowno as single, pagenumber as integer, redrawitem as boolean) as Integer
The function would receive the row number of the row to examine, the page number of the current page, and wether the function is to write each value into its respective text box on the form.
This function would return the item number of the item in question.
In the Form_Open, you reset the module variable Current_Page (to 1), then write the code that produces the first page of data, making sure that it checks each line for the item quantity to slip below its reorder level.
Change the record selector's code to reproduce each page.
OK, so if you aren't sure how to implement these changes then No, there isn't a way of changing the colour of each line in the combo box/list box. Microsoft didn't consider this when it released Access. I agree that it is a stupid idea for them not to consider this, but Access is a cheap system that was put in with other office products. In general Access is really only worth the hassle for small business solutions, not for complex GUI stuff that people think is always possible with Microsoft, It Isn't.
You may find on the web, other combo boxes that provide this kind of functionality. If I do, I will probably jump for joy, then reply back to this post.
Anyway, Hope this helps,
Mr Big.
Dont be small. be BIG