Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Developers    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query
Ronald de Boer 
      
2 years ago
Hi,

I have the following field in a form

OutputFileFld = ReportFolderFld & Year(Date) & "\" & "WaitList" & "\" & OutputFile

it is Dim'ed As String

I want to use OutputFileFld in a Query but the result in the query field is blank.

In the query I have DocumentName:Forms!VettrakWaitlistF!OutputFileFld

Please see code below.
Ronald de Boer OP  @Reply  
      
2 years ago

Ronald de Boer OP  @Reply  
      
2 years ago

Ronald de Boer OP  @Reply  
      
2 years ago
This will eventually be a Append Query and why I want to store the file loaction and file name in this field in the query.

What is the syntax or what coding do I need to do on the form or in the query to get this to work?

Thanks in Advance
John Davy  @Reply  
         
2 years ago
Hi Ronald
Is the name of your form Forms!VettrakWaitlistF ? Why does the code have "Waitlist"

John
Kevin Yip  @Reply  
     
2 years ago
OutputFileFld is a VBA variable, and VBA variables can't be used inside a query in such a manner.  You either to need to use string concatenation to to combine the SQL statement with the VBA variable, or create a custom VBA function that returns the value you want, then put the custom VBA function inside the query.  For your situation, the latter is probably simpler (although the former is the better way, and is how this kind of thing is usually done).  See the picture below as an example:
Kevin Yip  @Reply  
     
2 years ago

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

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: 8/11/2026 4:55:28 AM. PLT: 0s