FindFirst method

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 & """"
 
D

Dan Artuso

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?
 
E

eric

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 & """"


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top