I need to update a query with a macro. The reason I want to update with a macro instead of an update query is because there are values that the macro gets which are the basis for the updating. Example scenario: The user selects a vendor, the vendors email is found and then the macro gets the Quantity, and PartNumber and input it all in outlook. That part is good but I run into a problem where the macro wont update the query and throws and error (missing operator). Code below:
Dim strSql As String
Dim searchFor As String
Dim dbsTooling As DAO.Database
Dim rstToolingQuote As DAO.Recordset
Dim PN(20) As Variant 'gets part numbers which go in to email
Set rstToolingQuote = dbsTooling.OpenRecordset("qToolingQuote")
searchFor = InputBox("Would you like RFQ to be checked (y/n)", "Check RFQ?")
If searchFor = "y" Or searchFor = "Y" Or searchFor = "yes" Or searchFor = "YES" Then
For I = 1 To rstToolingQuote.RecordCount Step 1
strSql = "UPDATE qToolingQuote SET RFQ = False WHERE PartNumber = " & PN(I)
dbsTooling.Execute strSql
Next
End If
Below is the error I get:
Run-time error '3075':
Syntax error (missing operator) in query expression 'PartNumber = SHDYTS.9-GDYU'.