UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Update, Access 2016    
 
   
mike60smart
post Aug 15 2019, 08:12 AM
Post#1


UtterAccess VIP
Posts: 13,419
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I am getting the following error when trying to run the following ON Click Event.

The Immediate Window shows no values.

Any help appreciated.

Error is:-

Attached File  error.PNG ( 3.2K )Number of downloads: 0


Code is:-

CODE
strSQL = "UPDATE tblPayrollVar SET OTFine = " & lngOTFine & ", Arrears = " & lngArrears _
& ", OTAppreciation = " & lngOTAppreciation & ",CMSV Remarks = '" & Me.CMSV _
& "' WHERE EmployeeID = " & Me!EmployeeID & ";"

CurrentDb.Execute strSQL, dbFailOnError

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
strive4peace
post Aug 15 2019, 08:57 AM
Post#2


strive4peace
Posts: 20,459
Joined: 10-January 04



hi Mike,

if any values aren't defined, then there will be an error. Assuming all the variables have values, then perhaps you want to test the controls before you use them?

CODE
if isNull(Me.CMSV ) then
   msgbox "CMSV needs a value",,"Exiting"
   exit sub 'or function
end if
if isNull(Me.EmployeeID ) then
   msgbox "EmployeeID needs a value",,"Exiting"
   exit sub 'or function
end if

--------------------
have an awesome day,
crystal
Go to the top of the page
 
HansUp
post Aug 15 2019, 09:05 AM
Post#3



Posts: 53
Joined: 19-September 14
From: Colorado USA


When you have a field whose name includes a space, bracket that name in your SQL so that the db engine will recognize it properly.

Change ",CMSV Remarks = '" & Me.CMSV to ",[CMSV Remarks] = '" & Me.CMSV
Go to the top of the page
 
mike60smart
post Aug 15 2019, 09:54 AM
Post#4


UtterAccess VIP
Posts: 13,419
Joined: 6-June 05
From: Dunbar,Scotland


Hi HansUp

Many thanks it was the space in the name that needed fixing.

Now works just fine.

Many thanks everyone
cheers.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    19th October 2019 - 03:03 PM