Hi there,
Can anyone see why I am getting a syntax error with this code:
Dim varx As Variant
varx = DCount("*", "[tblKSFOutline]", "[OutlineTitle]='" & Forms!FormMain!OutlineTitle & "'")
CurrentDb.Execute "UPDATE [tblKSFOutline] SET [addRecord]=" & varx & " WHERE OutlineTitle='" & Forms!FormMain!OutlineTitle & "' AND WHERE Location='" & Forms!FormMain!Location & "'"
I have a similar bit of code working on another form but I have changed the last where clause and I am getting the error message, all fields are text except "addrecord" (number). When I debbug I am getting all the right readings and the record is being saved but it is not entering the varx.
Can anyone see why I am getting a syntax error with this code:
Dim varx As Variant
varx = DCount("*", "[tblKSFOutline]", "[OutlineTitle]='" & Forms!FormMain!OutlineTitle & "'")
CurrentDb.Execute "UPDATE [tblKSFOutline] SET [addRecord]=" & varx & " WHERE OutlineTitle='" & Forms!FormMain!OutlineTitle & "' AND WHERE Location='" & Forms!FormMain!Location & "'"
I have a similar bit of code working on another form but I have changed the last where clause and I am getting the error message, all fields are text except "addrecord" (number). When I debbug I am getting all the right readings and the record is being saved but it is not entering the varx.