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 
Error Code 2465
Robert Sena 
    
4 years ago
When writing VBA code in Access, I get an error message
"Run Code '2465'
"Microsoft Access can't find the field '|1' referenced to in your expression"

I input the following syntax:

Private Sub BtnLocTot_Click()
    DoCmd.OpenForm "LocationTF", OpenArgs:=Me.[SumQtyRpt]
End Sub
Scott Axton  @Reply  
        
4 years ago
I'm pretty sure the problem is withe the OpenArgs.  
Where did you get that?  That isn't something Richard teaches.

What are you trying to do?
Robert Sena OP  @Reply  
    
4 years ago
I googled it.  Earlier I tried to use the syntax you provided but didn't work for me.  I'm trying to pull a total from a linked form which is a total to my main form.  I haven't got into the VBA courses yet.  Still a newbie.
Robert Sena OP  @Reply  
    
4 years ago
I wrote the following syntax earlier as suggested, but I was getting an error that it is expecting an =
Private Sub BtnSumRpt_Click()
  LOOKUP("SumQtyRpt","LocationTF","ID=" & ID)
End Sub
Scott Axton  @Reply  
        
4 years ago
Got  ya.  Would you please explain a little better what you are trying to accomplish?  
Maybe even provide a screenshot or two to help us understand.  Black out any sensitive info if you need to.
Robert Sena OP  @Reply  
    
4 years ago

Robert Sena OP  @Reply  
    
4 years ago

Robert Sena OP  @Reply  
    
4 years ago

Robert Sena OP  @Reply  
    
4 years ago

Robert Sena OP  @Reply  
    
4 years ago
I'm trying to get the total from the green form (footer) to a text field on the main form.  I wrote the syntax and inserted it on the click event of the text box I set up on the main form.
Adam Schwanz  @Reply  
           
4 years ago
Its DLookup not Lookup, and you'd want to do it like

FieldName = DLOOKUP(stuff)
Kevin Robertson  @Reply  
          
4 years ago
Unfortunately I can't see what's going on in the images as they are way to small, but this video may help.

Value From A Form
Robert Sena OP  @Reply  
    
4 years ago
what do you mean FieldName = DLOOKUP(stuff)?  Does it go somewhere in the syntax. Did't realize I left out the D. That should make a difference.
Robert Sena OP  @Reply  
    
4 years ago
Thanks Kevin. I've seen the video but I think it needs to be done with code.  Tried most everything. Just something I'm doing wrong.
Adam Schwanz  @Reply  
           
4 years ago
You cant just do a random dlookup, it doesn't do anything.

You're trying to set a field on your form to a certain value right? So get that fields name and replace my examples, say your field is called LocationField

In the on click event of that button that is running this code put this code, replacing with your fields - Note that ID may not be correct for you either, thats just an example, if your identifying field is called customerID then you'd do CustomerID=" & CustomerID

LocationField = DLOOKUP("SumQtyRpt","LocationTF","ID=" & ID)
Scott Axton  @Reply  
        
4 years ago
If you haven't already go watch this one too.  Intro to VBA
Kevin Robertson  @Reply  
          
4 years ago
Is SumQtyRpt a calculated field in the Form Footer? If so, which field is summed to get the result?
If the above is correct you will need to use DSum, not DLookup.

Also, LocationTF is the name of the Form and cannot be used in the function. This should be either a Table or Query.
Robert Sena OP  @Reply  
    
4 years ago
Kevin,

I set it up as in the text box On click Event Procedure as:

Private Sub BtnSumRpt_Click()
  DSum("QuantityRpt","SumOfitemsDailyQ","ID=" & ID)
End Sub


Note that in the Query, I am using the Sum for "QuantityRpt" which provides a sum of each item reported per day.

I am getting a Compile error "Syntax error"  Not sure if you can tell by the information I provided.  I will get you more info if needed.  I am starting to understand the concept a little better.  Thanks.
Kevin Robertson  @Reply  
          
4 years ago
As Adam said above you need to set the function equal to something.
Robert Sena OP  @Reply  
    
4 years ago
It worked.  Many Thanks.  This stuff can get so frustrating.
Richard Rost  @Reply  
          
4 years ago
I'm glad you got it working, Robert. And yes, it can be frustrating if it's new to you. Just remember, you can't just Google something and expect it to just plug right into your database. You haven't even gotten to the Developer lessons yet, so just take it slow. You'll get there.

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/10/2026 2:28:34 AM. PLT: 0s