By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

Table update problem

P: 5
For two days I have tried every combination of code I could find / think of. I have a simple update I want to do to a field, but I am getting a data type miss match error when I set the WHERE to a varable.

Here is what I have;

Dim MyID As Integer
MyID = UserName.GetUserName()
DoCmd.RunSQL "UPDATE tblEmployees SET [strEmpPassword]='" & Me.txtNewPassword.Value & "' WHERE [lngEmpID] ='" & MyID & "';"

The function GetUserName() works everywhere else I use it. It returns the record ID number for the user.

I can replace the MyID in the SQL statement to a number and it works. I have also replaced UserName.GetUserName() with a number and it breaks the SQL query also. I just do not know where to go from here. Any help would be great.
Jan 2 '08 #1
Share this Question
Share on Google+
3 Replies


FishVal
Expert 2.5K+
P: 2,653
Get off the single quotes around MyID.
Jan 2 '08 #2

P: 5
Wow, OK that worked. Thank you. Quick question, is there a way to not have access notify the user that they are "about to update 1 row"?

** I found the answer in another post. Thank you again
Jan 2 '08 #3

FishVal
Expert 2.5K+
P: 2,653
You are welcome.

Best regards,
Fish
Jan 2 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.