Hi thanks for your help - your suggession didn't work - there still seems to
be a problem with the quotation marks somewhere (God i hate these !!)
below is the whole function: (the MsgBox's are just so as i know whwre the
code gets to!)
Thanks again for your help
Alex
Public Function addLicence()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim PS As String
' close seletion form and update purchasers record with licencee
DoCmd.Close acForm, "frmSelOrganisation"
PS = "Show"
MsgBox "Line1"
'CurrentProject.Connection.Execute "Update tblSWPurchases SET
[LicenceeName]= & " '" & LName & "'" & " WHERE [SWPurchaseId]=" & SWID
MsgBox "Line2"
'CurrentProject.Connection.Execute "Update tblSWPurchases SET
[LicenceeName] ='" & LName & "'WHERE [SWPurchaseId]=" & SWID
CurrentProject.Connection.Execute "Update tblSWPurchases SET [PStatus]
='" & PS & "'WHERE [SWPurchaseId]=" & SWID
CurrentProject.Connection.Execute "Update tblSWPurchases SET
[LicenceeId] ='" & Lid & "'WHERE [SWPurchaseId]=" & SWID
' create licencee record
rs1.Open "tblSWLicences", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
With rs1
MsgBox "hello"
.AddNew
.Fields("RecordId") = RecId
.Fields("LicenceeName") = LName
.Fields("LicenceeId") = Lid
.Fields("SWPurchaseId") = SWID
.Fields("Software") = SW
.Update
End With
rs1.Close
End Function
Well I'm not sure about the
CurrentProject.Connection.Execute if you post more of your
code perhaps helps me..
About the connection I think you need something like
cmd.ActiveConnection = CurrentProject.Connection
Set rstSomething = cmd.Execute(bla bla)
but anyways since the problem appear to be in the syntax
have you tried with:
CurrentProject.Connection.Execute "Update tblSWPurchases
SET [LicenceeName]
= & "'" & LName & "'" & " WHERE [SWPurchaseId]=" & SWID
-----Original Message-----
Hi can someone tell me what is wrong with the syntax below. When I run it,
i keet getting a syntax error message, and i have looked and looked and
looked...
CurrentProject.Connection.Execute "Update tblSWPurchases SET [LicenceeName]
='" & LName & "'WHERE [SWPurchaseId]=" & SWID
Thanks
Alex
.