|
Subject:
|
Combobox that shows what's not in its list
|
|
Posted By:
|
Mitch
|
Post Date:
|
9/17/2003 2:58:41 PM
|
Anyone have a good idea of how to show the information in a field where it is not in the combobox?
I have a form that uses a combobox to select equipment, it show the description but stores the ID. I want to now make it filter out any "inactive" equipment. I can do that in the querey but the problem is that any exisiting records now don't show me what that equipment was if it contains a piece of equipment that is now marked "inactive".
I thought about just haveing a field on top of the combobox that does a DLookup to show the "old info" but still allows the user to select the down arrow of the combobox that is postiioned behind it.
Isn't there anyway to do it with just one combobox?
Mitch
|
|
Reply By:
|
SerranoG
|
Reply Date:
|
9/17/2003 3:57:10 PM
|
Mitch,
Just because you're filtering the data in the form based on the combobox, doesn't mean that the combobox's rowsource should change. If it does, then you need to remove any VBA statement that resets the combobox's rowsource. Set it once on the form's On Open event and leave it alone.
Greg Serrano Michigan Dept. of Environmental Quality, Air Quality Division
|
|
Reply By:
|
Mitch
|
Reply Date:
|
9/17/2003 4:28:00 PM
|
Greg,
I am not filtering the data on the form.
The form shows what is in one table, the combobox does not show what is in the table when the record source (querey) of the combobx is not showing equipment that is newly taged with "inactive".
I don't want the user to be able to select "inactive" pieces of equipment when entering a NEW record, but I do want them to see what the description is of the equipment of the records that are allready there.
Mitch
|
|
Reply By:
|
Braxis
|
Reply Date:
|
9/18/2003 3:53:45 AM
|
Mitch
Does the user need to be able to edit the old records?
If not, you could put some code in the Current event of your form that checks whether the current record is a new record (Me.NewRecord) and then changes the RowSource of the combo box appropriately.
Brian Skelton Braxis Computer Services Ltd.
|
|
Reply By:
|
SerranoG
|
Reply Date:
|
9/18/2003 7:33:04 AM
|
Mitch,
OK, let me understand better. You have a form, and on this form you have a checkbox or some kind of indicator that this equipment is inactive or not. The form always shows all records; it's just that some of them are checked "inactive." You also have this combobox to choose the type of equipment on the form for each record. You want people to see all equipment when the combobox is expanded, but when they pick items, you don't want them to pick inactive equipment off that list. Is that right?
So in a sense, you'd like to be able to "gray out" some items in the list of a combobox.
Greg Serrano Michigan Dept. of Environmental Quality, Air Quality Division
|
|
Reply By:
|
Mitch
|
Reply Date:
|
9/18/2003 10:55:54 AM
|
I have a table that contains equipment; table A. Some are marked "active" the others are "inactive".
I have a table that contains job information;call this table B, that in addation to other data, has a field for "equipment" used.
My form shows all the data from table B. When entering a new record into it, the same form has a combobox that shows table A in it.
If I put in the combobox criteria to just show "active" items in the combobox, that is fine for new records, but if the user uses the form to show past or old records then any of the equipment in the table that is NOW marked "inactive" will not display in the combobox on the form (because they are not in the underlying query of that combobox). So they have no idea what equipment WAS used.
I don't want to make two forms, one for new records and one for Old records.
I hope that helps make my issue more clear.
Mitch
|
|
Reply By:
|
Mitch
|
Reply Date:
|
9/18/2003 11:00:14 AM
|
That's a neat idea. I'll have to see how well that might be implimented.
But I am still open for more suggestions.
Mitch
quote: Originally posted by Braxis
Mitch
Does the user need to be able to edit the old records?
If not, you could put some code in the Current event of your form that checks whether the current record is a new record (Me.NewRecord) and then changes the RowSource of the combo box appropriately.
Brian Skelton Braxis Computer Services Ltd.
|