Solved Too few parameters in SQL UPDATE statement

Ryan142

Member
Local time
Today, 04:44
Joined
May 12, 2020
Messages
52
Didn't expect to be back so quickly, but here we are...

I'm running an SQL UPDATE Statement to update a users record for information stored on them

This is the code I'm using

Code:
SQLForename = "UPDATE tblUserDetails SET FirstName = " & txtForename & " WHERE LoginID = " & LoginID

LoginID is a public variable defined when the user logs in as a unique id for the user as they enter the system

This is repeated for each text box input then it's run with this:

Code:
CurrentDb.Execute (SQLForename)

This is also copy and pasted for each text box.

Call me blind, but I can't see the issue - although I'm sure it'll be pointed out to me easily.

Any help is as always greatly appreciated.

Thanks, Ryan
 
Try:

SQLForename = "UPDATE tblUserDetails SET FirstName = '" & txtForename & "' WHERE LoginID = " & LoginID
 
looks like you are missing some single quotes

"UPDATE tblUserDetails SET FirstName = '" & txtForename & "' WHERE LoginID = " & Login

if you debug.print the sql then copy paste to a new query, it often becomes obvious what the problem is
 
Try:

SQLForename = "UPDATE tblUserDetails SET FirstName = '" & txtForename & "' WHERE LoginID = " & LoginID

Fantastic that works, for future reference, why is it just that txtForename part that needs to be put in quotes as well?
Thanks for the reply
 
Fantastic that works, for future reference, why is it just that txtForename part that needs to be put in quotes as well?
Thanks for the reply
Hi. Just in case it helps, take a look at this article. Cheers!
 

Users who are viewing this thread

Back
Top Bottom