Lookup field table/value based on another fields value

RobertEastham

New Member
Joined
Feb 10, 2004
Messages
2
Is it possible for a field to change depending on the value of another? What I want is to have lookup field 1 and in it I have 5 letter types, if I choose "support letter" then the next lookup field displays the choices from the "support letter" table. If I choose "transfer letter" then it displays the choices from the "transfer letter" table and so on. Am I making any sense?

Thank you for your help. :rolleyes:
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Robert

If the values in your list are named after tables then I would just add the following line to the Change Event of the list/ComboBox (or whatever) control, something like so :

Code:
Private Sub Combo3_Change()
    Dim strSQL As String
    Dim vara

    vara = UserForm1.Combo1.Value
    strSQL = "SELECT * FROM " & vara & ""

    UserForm1.RecordSource = strSQL
End Sub

Add this code to the control that has the options. Just change the names (UserForm1) and numbers (Combo3) to whatever yours are and every time you select a new value in the list your form will show the records for that table name - the "Transfer Letter" table or the "Support Letter" table etc.

Try That

anvil19
:eek:
 
Upvote 0
Yes, assuming that you are using combo boxes the way to do it is to base the second box on a query that is filterd by using the first box as the criteria. In the first combobox you need to set its AfterUpdate event to requery the second combobox.

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,621
Messages
6,160,879
Members
451,675
Latest member
Parlapalli

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