FindFirst method

  • Thread starter Thread starter eric
  • Start date Start date
E

eric

I get a syntax error (missing operator in expression for
the rst.FindFirst statement. The SQL statement combines 2
fields into one variable "Expr1". I'm not sure if I can
treat it as a field name.

str = "SELECT [PO Parts].[PO#], [PO Parts].Description,
[PO Parts].Qty, " & _
"[PO Parts].QtyRecd2, [PO Parts].TotQtyRecd2, [PO
Parts].OrgOrdQty, " & _
"([PO Parts].Description & CStr([PO Parts].[PO#])) AS
Expr1 " & _
"FROM [PO Parts] ORDER BY [PO Parts].Description &
CStr([PO Parts].[PO#]);"
Set rst = db.OpenRecordset(str, dbOpenDynaset)
..
..
..
rst.FindFirst "[Expr1] = """ & strID & """"
 
Hi,
I wasn't sure either so I tested it out and you can refer to the alias
as the field name. What is strId? Does it contain qoutes within itself?
 
Dim strID As String
strID = rst!Description & CStr(rst![PO#])
-----Original Message-----
Hi,
I wasn't sure either so I tested it out and you can refer to the alias
as the field name. What is strId? Does it contain qoutes within itself?

--
HTH
Dan Artuso, Access MVP


I get a syntax error (missing operator in expression for
the rst.FindFirst statement. The SQL statement combines 2
fields into one variable "Expr1". I'm not sure if I can
treat it as a field name.

str = "SELECT [PO Parts].[PO#], [PO Parts].Description,
[PO Parts].Qty, " & _
"[PO Parts].QtyRecd2, [PO Parts].TotQtyRecd2, [PO
Parts].OrgOrdQty, " & _
"([PO Parts].Description & CStr([PO Parts].[PO#])) AS
Expr1 " & _
"FROM [PO Parts] ORDER BY [PO Parts].Description &
CStr([PO Parts].[PO#]);"
Set rst = db.OpenRecordset(str, dbOpenDynaset)
.
.
.
rst.FindFirst "[Expr1] = """ & strID & """"


.
 
Back
Top