Update Text Box based on List Box Selection on Access

wwce

New Member
Joined
Feb 4, 2013
Messages
19
My data set are:

- Form titled "Form Members"
- List Box named "Agents"
- Text Box named "EmployeeID".
- Table Source called "tblAssociate" where the employee is under "AssociateName" and employee ID under "AssociateNumber".

When the user clicks on an agent's name in the List Box, the Text Box is supposed to populate agent's employee ID.

QUESTION: How do I get that to work?

So far... my thinking is on the "On Click" event procedure on the List Box is to add a DLOOKUP code, but I can't get it to work:

EmployeeID = DLookup("AssociateNumber", "tblAssociate", "AssociateName = " & [Forms]![Form Members]![Agents])

However, it doesn't work.

Any help is greatly appreciated, thanks.
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
My data set are:

- Form titled "Form Members"
- List Box named "Agents"
- Text Box named "EmployeeID".
- Table Source called "tblAssociate" where the employee is under "AssociateName" and employee ID under "AssociateNumber".

When the user clicks on an agent's name in the List Box, the Text Box is supposed to populate agent's employee ID.

QUESTION: How do I get that to work?

So far... my thinking is on the "On Click" event procedure on the List Box is to add a DLOOKUP code, but I can't get it to work:

EmployeeID = DLookup("AssociateNumber", "tblAssociate", "AssociateName = " & [Forms]![Form Members]![Agents])

However, it doesn't work.

Any help is greatly appreciated, thanks.

In your list box property - the after update event is where you could put your dlookup.
 
Upvote 0
In your list box property - the after update event is where you could put your dlookup.

Thanks, I tried that, still getting the same error :(

Let's say I click the name 'Jane Doe' in the List Box, the error I get says:

Run-time Error '3075'
Syntax error (missing operator) in query expression 'AssociateName = Jane Doe'
 
Last edited:
Upvote 0
Text syntax requires those quotations or double quotations, what you had before it was looking as a number in essence and couldn't match the employee name (since the AssociateName field is likely text).
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,864
Members
449,052
Latest member
Fuddy_Duddy

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