General discussion



By hughlee02 ·
I have a syntex error(missing operator) in expression for the FindFirst statement in following code which run in access form vba routine

Option Explicit

Private Sub Form_Load()
On Error GoTo errAddNode

Const strTableQueryName = "Quantity"

Dim db As DAO.Database, rst As DAO.Recordset
Dim strParentField As String
Dim strCriteria As String

Set db = CurrentDb
Set rst = db.OpenRecordset(strTableQueryName, dbOpenDynaset, dbReadOnly)
strParentField = "NEXT ASSEMBLY"

strCriteria = BuildCriteria(strParentField, _
rst.Fields(strParentField).Type, "=" & "21120 - 1")

rst.FindFirst (strCriteria) 'syntex error (missing operator) in expression.

exitAddNode: Exit Sub

MsgBox Err.Description, vbCritical, "Error:"
Resume exitAddNode
End Sub

Help please!!!!

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by stephen.kendall In reply to dao.recordset.FindFirst

It looks like the the field name you store in strParentField contains a space, which will cause an error. Try adding square brackets around the field name like this:

strParentField = "[NEXT ASSEMBLY]"

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums