Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Text Box Control Source
Richard Stein 
      
3 years ago
I use this as the control source to display the "country name" in the text box which is stored in the table "countries"  and the "CountryID" is stored in another text field, "ENTCountryID on the open form

=DLookUp([CountryName],[Countries],[Countries]![CountryID]=[Forms]![New Record For Entity]![EntCountryId])

It doesn't run and the text box displays "#Name?

I really don't know why?
Kevin Robertson  @Reply  
          
3 years ago
Your DLookup syntax is wrong.

Watch this video: DLookup
Richard Stein OP  @Reply  
      
3 years ago
Thank You for that.  The expression builder took away all the quotes I had.  I have another question, the next box needs to be populated by a query that has an inner join to a related table.  This query runs fine. what is the syntax to put the query name in the control source?
Also, what is a normal tip for your service?  Is there one?
Kevin Robertson  @Reply  
          
3 years ago
Make the Record Source of your form whatever your query name is.
Ten you can add any of the fields in your query to the Control Source of your Text Box.

(Make sure the query is updateable otherwise you won't be able to Add or Edit Records)
Not Updateable

If the Recordset is not updateable you can still use DLookup as before using the Query name instead of a Table name.
Richard Stein OP  @Reply  
      
3 years ago
I am sorry if I am unclear.  When I fixed the syntax, everything worked fine.  Thank You.

My next question is abut filling the value in a second field.  I would rather put the name of the query that works in the control source for that field because that query has an inner join to a second table.  If that is possible, what is the right syntax?  If not can the  Dlookup function handle it?  Thank You
Richard Stein OP  @Reply  
      
3 years ago
I tired putting the query in the dlookup in place of the table but it gave me errors in syntax

= DLookUp("ContZone", "GetContZone", 'CountryID=" & [Forms]![New Record For Entity]![EntCountryId])

The query GetContZone below, already contains the criteria so including it in the Dlookup is redundant?

SELECT [Continental Zones].ContZones, Countries.CountryID
FROM Countries INNER JOIN [Continental Zones] ON Countries.ContinentalZone = [Continental Zones].ContZoneID
WHERE (((Countries.CountryID)=[Forms]![New Record For Entity]![EntCountryId]));
Kevin Robertson  @Reply  
          
3 years ago
You have a single quote in front of CountryID instead of a double quote.
If the criteria isn't needed leave it off. It's optional.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/22/2026 3:16:04 PM. PLT: 0s