How to bind textbox value to the table if Control Source has = DLookup inside it

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I'm still learning Access and I have a few questions.

1. I believe that "Control Source" links the matching field textbox from the form to that field in the table. Is that correct? I learned that if I need to pull data to the matching field in the forms textbox DLookup is the best option.
2. If I put the DLookup inside the Control Source, how do I bind it to the table?

So I have a query named "EmployeeQuery" that DLookups uses to populate that textbox.
VBA Code:
=DLookUp("FullName","EmployeeQuery","Badge_ID = " & Nz([EmpBadgeID],0))

Since this code is placed inside the "Control Source" how can I bind that found textbox.value to the table? I hope my question is easy to understand. Thank you.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
1) True but correctly put, the the control source property identifies which query or table field that the control is bound to.
1b) No. Bound fields are the best approach most of the time.
2) You cannot. Your example is about a calculated control (it's not a field). See 1b.
Queries should virtually never use domain lookup functions. If that statement is related to the following
=DLookUp("FullName","EmployeeQuery","Badge_ID = " & Nz([EmpBadgeID],0))
then that is not a query, it's an expression. No disrespect intended, but since you're posting on an Excel site I imagine your table designs will not be proper. You might want to review these to get off to a better start than a lot of people. Too many Excel users suffer from spreadsheetitis because they didn't study db normalization.

Normalization Parts I, II, III, IV, and V
and/or

Entity-Relationship Diagramming: Part I, II, III and IV

How do I Create an Application in Microsoft Access?

Naming conventions
- General: Commonly used naming conventions
- MS Access Naming Conventions

What not to use in names
- Microsoft Access tips: Problem names and reserved words in Access

About Auto Numbers
- General: Use Autonumbers properly

The evils of lookup fields - The Access Web - The Evils of Lookup Fields in Tables
Table and PK design tips - Microsoft Access Tables, Primary Key Tips and Techniques
About calculated table fields - Microsoft Access tips: Calculated Fields
About Multi Value Fields - Multivalued Fields

Last/First/DLast/DFirst Explained
- ORDER BY - First, Last and always!
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

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