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 
Default value to combo box
Joseph Dolbear 
    
3 years ago
I cannot get the default value for a combo box to retrieve the value that I need.

I have a subform that has a category and subcategoy combo boxes in a cascading setup to enter transaction line items into the table tTransactionItems. The subcategory table, tSubcategories contains the field UM, Unit of Measure, as does the TransactionItems table. The unit of measure field is a combo box with a source qUMList, which contains only the field UM.

I want to pull the UM value from the tSubcategories as a default value for the UM.

The control source for the combo is: ELECT [qUMList].[UM] FROM qUMList ORDER BY [UM];

I tried adding a default value in the table of:
=[qTransactionItems]![tBudgetSubcategory]![UM]

When I open the for the UM field is the error #FIELD

Any ideas appreciated.
I added a Me.Requery, and alternately a Me.Refresh in AfterUpdate for the Subcategory field and it is not adding the default value. The UM field is blank.
Kevin Yip  @Reply  
     
3 years ago
You get the error because you use an invalid expression.  Are "qTransactionItems" and "tBudgetSubcategory" a query and a table?   "!" means "a parent of", but a query is not the "parent" of a table.  Also, queries and tables are sets of data.  To pull a single value out of them, you need criteria -- such as with a DLookup() function, which you can use for your purpose.  For instance, use the following expression for your default value instead:

   =DLookup("[UM]", "TableToPullUMFrom", "Criteria")

Criteria are the same ones you use in SQL, and they look something like: [Category] = '1234'



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/16/2026 7:30:38 PM. PLT: 1s