Error 3075 missing Operator (1 Viewer)

RonLavi

New member
Local time
Today, 12:15
Joined
Feb 16, 2017
Messages
3
Trying to update a field (c_xwo) in a table (NOCtable) and gets errors
(UPDATE SET WHERE)

1. Runtime error 3075. Syntax error (missing operator)
2. I also get “This recordset is not updatable”

public gc_xwoVal As String
Public c_wo As String
'Public n_nocID As String
Public gc_NOCnum As String
Public gc_TempXO As String
Option Explicit

___________________________________________________________
Code starts here…
What am I doing wrong?

Public Sub UpdateNOC()

Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("NOCtable", dbOpenDynaset)



'Set rs = Me.RecordsetClone
rs.FindFirst "[noc_no]=" & gc_NOCnum

If rs.NoMatch Then
MsgBox "Sorry, no such record exists " & gc_NOCnum

Else
Dim sSQL As String
sSQL = "UPDATE NOCtable SET [c_xwo] = &gc_xwoVal "
WHERE RTRIM(NOCtable.noc_no) = RTRIM(gc_NOCnum) ;"
DoCmd.RunSQL sSQL

Here is where I get the errors:
Runtime error 3075. Syntax error (missing operator)
I also get “This recordset is not updatable”

End If
rs.Close

End Sub
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:15
Joined
Sep 21, 2011
Messages
14,464
If you debug print the sSQL string you should easily see your error.

I believe you need
Code:
sSQL = "UPDATE NOCtable SET [c_xwo] = " & gc_xwoVal
sSQL = sSQL & " WHERE RTRIM(NOCtable.noc_no) = " & RTRIM(gc_NOCnum)

assuming gc_xwoVal and gc_NOCnum are numeric

Unsure why the RTRIM(gc_NOCnum) in that case?

Edit: OK just went back and saw the declarations.
So try
Code:
sSQL = "UPDATE NOCtable SET [c_xwo] = '" & gc_xwoVal & "'"
sSQL = sSQL & " WHERE RTRIM(NOCtable.noc_no) = '" & RTRIM(gc_NOCnum) & "'"

HTH
 

Users who are viewing this thread

Top Bottom