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 
Appointments - Duration
Peter Yates 
     
7 months ago
I modified a downloaded copy of "Appointments" trying to use for bookings spanning a number of days. I created a Query with an aliase Duration:Int([EndDateTime]-[StartDateTime]). This shows correctly when the query is run, but having changed the Control Source of AppointmentF to the query "BookingsQ", the control Duration produces a #Name? error. Even a new TextBox with the control source set to Duration gives the same error. I understand that Access sometimes doesnt like the order of these things, but any way round without rebuilding the form again from scratch?
Peter Yates OP  @Reply  
     
7 months ago
Add, creating a new for with the query as the record source works fine, including the Duration field, so I'm sure its not a simple spelling error.
Lars Schindler  @Reply  
     
7 months ago
ChatGPT:

✅ Explanation

The fact that the query works fine and a new form based on it displays the Duration field correctly tells us a lot:

The query itself is valid.

The alias name Duration is fine.

The expression Int([EndDateTime]-[StartDateTime]) is valid.

There’s no spelling or data type issue.


So the problem is not with your query — it’s with the existing form object.

Access forms store a hidden “field binding cache” internally.
When you change the Record Source of a form (especially from a table to a query that includes new calculated fields), Access doesn’t always refresh its internal field list.
As a result, the form simply doesn’t “know” about the new field, even though the query provides it — and that’s exactly when you see #Name?.

---

🧰 Fix

You don’t need to rebuild the form.
Just force Access to refresh its field bindings:

Option 1 – Simple manual reset

1. Open the form in Design View.

2. Clear the Record Source property completely.

3. Save and close the form.

4. Reopen it in Design View.

5. Set the Record Source back to your query (BookingsQ).

6. Save again.

This forces Access to rebuild the internal field list.
After that, the Duration control will work as expected.

Option 2 – Do it in code If you want to trigger it dynamically (e.g., from VBA):

Me.RecordSource = "BookingsQ"
Me.Requery

---

🧩 Summary

#Name? in this case doesn’t mean “bad expression” or “format problem” —
it means “Access hasn’t recognized the new field yet.”

That’s why:

> The same query works perfectly in a new form, but not in the old one.
Peter Yates OP  @Reply  
     
7 months ago

Peter Yates OP  @Reply  
     
7 months ago

Peter Yates OP  @Reply  
     
7 months ago

Peter Yates OP  @Reply  
     
7 months ago

Peter Yates OP  @Reply  
     
7 months ago
Lars, I really appreciate your help and I've tried both suggestions but still this field (Now it's "Nights"), just will not work in the form. Some screenshots above. Peter
Kevin Robertson  @Reply  
          
7 months ago
Peter Try deleting the field on the Form then re-add it.

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: 5/2/2026 7:11:42 AM. PLT: 1s