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 
Problem with Update SQL String
Gary Becker 
     
3 months ago
What is wrong with this code?
CurrentDb.Execute "UPDATE InvoiceT SET Check = CkNum WHERE InvoiceID=" & [TempVars]![InvoiceID]

I've verified that CkNum exists and is a number. If I replace CkNum with a number like 300 then the it works.
I get Run-time error 3061. Too few parameters. Expected 1.
Thomas Gonder  @Reply  
       
3 months ago
Try putting Check in brackets?
Thomas Gonder  @Reply  
       
3 months ago
Or CkNum isn't a numeric field in the table?
Kevin Robertson  @Reply  
           
3 months ago
Too few parameters. Expected 1

This means Access doesn't recognise one field in your SQL statement.
It is either mis-spelled or doesn't exist.
Gary Becker OP  @Reply  
     
3 months ago
I've tried [Check]=CkNum. Check is a Long Integer field in the table. I've used this code: MsgBox CkNum + CkNum   to check that it is a number and the MsgBox doubles the check number value--so it is numeric. And if I hard-code the check number like: Check=301  then it works fine. But when I try to use a variable, it doesn't.
Kevin Robertson  @Reply  
           
3 months ago
Try this.

CurrentDb.Execute "UPDATE InvoiceT SET Check=" & CkNum & " WHERE InvoiceID=" & [TempVars]![InvoiceID]
Gary Becker OP  @Reply  
     
3 months ago
Wow. Kevin. Yes. That makes it work! Thanks for your input.
Kevin Robertson  @Reply  
           
3 months ago
You're welcome.

Remember: the variable should be outside the quotes.

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

Next Unseen

 
 
What's This?

 

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: 9/5/2026 4:51:10 AM. PLT: 1s