Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VarX Syntax error 1

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
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.

 
I think that your SQL code should read:

Code:
"& varx & " WHERE OutlineTitle='" & Forms!FormMain!OutlineTitle & "' [COLOR=red] AND Location='" & Forms!FormMain!Location & "'"
[/color]

Hope this Helps,

ALex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Thanks Alex that worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top