1

I have a lookup field in my table based on another table. I'm having trouble filtering those values based on another field that is entered prior to the field.

Is it possible to filter a lookup field based on another field?

EDIT

Let me try and clarify my original question, sorry about that. Ok, so I have a table1 that has the following fields: ID, Name, Logo.

If a user enters a specific name in the Name field, when they click on the Logo field, it'll only display those values associated that are similar to the name entered. Does that make any sense? If it does make sense, would there be an easier suggesion on accomplishing this task?

Linger
  • 14,942
  • 23
  • 52
  • 79
Muhnamana
  • 1,014
  • 13
  • 34
  • 57
  • Can you show us what you've tried? Your description is a little sketchy as to what you're getting at. Do you want cascading combos? – HK1 Sep 26 '13 at 02:31
  • 1
    I would honestly stay away from defining Lookups in tables. It is so easy just to create a combo box on a form and specify your Row Source there. You can do more with it. Also, Lookups on table create unnecessary over head for the database. – Linger Sep 26 '13 at 14:12

3 Answers3

3

If you're talking about inside a table, the answer is "No". You can create cascading combo boxes on a form, but you can't base a lookup value in a field of a table off of a different field in that table (or the field in any other table).

Johnny Bones
  • 8,786
  • 7
  • 52
  • 117
2

Here is an example of how to handle filtering a combo box based on the value selected in another combo box:

I have the following form:

enter image description here

The combo boxes are named cboIntPN and cboManPN.

The Row Source for cboIntPN is set to: SELECT uniq_key, part_no, revision FROM inventor. The Row Source for cboManPN isn't set to anything.

When the user selects a value for Internal PN the following AfterUpdate Event is triggered:

Private Sub cboInternalPN_AfterUpdate()
   [cboManPN].RowSourceType = "Table/Query"
   [cboManPN].RowSource = "SELECT uniqmfgrhd, mfgr_pt_no FROM invtmfhd " & _
                          "WHERE uniq_key = '" & cboIntPN.value & "'"
End Sub
Linger
  • 14,942
  • 23
  • 52
  • 79
0

It sounds like he is having the same issue as me. I also wanted to filter a field in a table for data entry on another field's input and my conclusion is "it is time I stopped entering data manually in tables and begin to create Data entry forms. I was putting this task off until later, but if I don't do it now, I might make worse trouble for myself later. Btw, what an old thread.

  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33619256) – Ike Jan 13 '23 at 15:23