A
APH
Hi, I am using the code below, but when I run it It am hitt a syntax error
with the '&' (my quotes) on the line below MsgBox "Line1"
This was a suggestion some kind person made in this Ng, my original code is
the line below MsgBox "Line2".
I have tried various combinations but cannot get it right - expect it is a
quotation mark in the wrong place !!
Thanks
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
with the '&' (my quotes) on the line below MsgBox "Line1"
This was a suggestion some kind person made in this Ng, my original code is
the line below MsgBox "Line2".
I have tried various combinations but cannot get it right - expect it is a
quotation mark in the wrong place !!
Thanks
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