Pre-selected list fields based on form selection

ayonae

New Member
Joined
Jul 3, 2007
Messages
29
Hey everyone,

This problem is driving me crazy and it's probably very simple. First, I'll give you an idea of how my database is structered.

Database summary:

This is an estimation database that uses tagged equipment and quantities, man hours, etc. to produce an estimation of cost for the client.

Each piece of equipment has a tag (unique), a product name, description and electrical ratings (volts, amps, etc.) that changes depending on the type of equipment.

Structure:
I created a table (called Equipment) that has the tags, name, descriptions and ALL the ratings of every piece of equipment (some are the same between equipment) all in one table. I have 2 extra fields in the Equipment table, "Type" and "Input OR Load" that would define which equipment I'm entering data for.

I created FORMS for all the different equipment types (motor, MCC, Vaccuum, etc.) since they have some different ratings that the user must input to.

I have created a switchboard that allows the user to choose which equipment type & load/input to edit or add new records to via the forms that I've created.

Problem:
When the user selects a form to edit/create new records for whichever equipment type, I want to PRESELECT the TYPE field (value list that has motor, mcc etc.) and INPUT/LOAD field (list of 2 selections, Input or Load).

This is because I want to FILTER the TAGS so that the user, when scrolling through records, ONLY sees the equipment type they are currently editing/adding records.

Hopefully I was clear! If not, let me know!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You could try creating an unbound combo box on the form's Header section, which selects all of the possible equipment types. Call it cmbSearch. Then, in the AfterUpdate event of the combo, code like this:

Code:
Me.Filter = "[Type]='" & cmbSearch.Value & "'"
Me.FilterOn = True

To use the AfterUpdate event, go to the Properties of the combo.
Select the Events tab, double-click After Update so you see Event Procedure, click the ... button at the end of the row, and you'll be in the code window. The code I provided goes into the blank line before End Sub.

Denis
 
Upvote 0
That works - but how do I remove the duplicates in the cmbSearch so I when I use the drop-down menu, I do not see more than one of the same type?
 
Upvote 0
In the combo, go to the RowSource property and click the ... at the end of the row to go to the query.
Go into SQL view. You will see SELECT ... FROM ...
Change it to SELECT DISTINCT ... FROM ...
That will select unique entries.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top