dlookup

  • Thread starter Thread starter R. Choate
  • Start date Start date
R

R. Choate

I need to return a single value from a 2-column persisted recordset (.dat
file). I've been trying to use a dlookup function without success. My
recordset fields are "Ticket" and "Weight", and I need to retrieve the
weight value which corresponds to a ticket number (text data type) which
matches the text in the "txtTkt" field on my open Access user form. I know
that the recordset exists, contains the correct data, and is open. Here is
my bad code that is within the class module for my form:

rst.CursorLocation = adUseClient
rst.Open "C:\Path\Somedata.dat", , adOpenStatic, adLockBatchOptimistic

X = Me.txtTkt

J = DLookup("Weight", rst, "Ticket = " & X)
 
I guess no one felt like tackling this one. Good thing I found a solution on
my own. I simply needed to use the find method on the recordset.
--
RMC,CPA


I need to return a single value from a 2-column persisted recordset (.dat
file). I've been trying to use a dlookup function without success. My
recordset fields are "Ticket" and "Weight", and I need to retrieve the
weight value which corresponds to a ticket number (text data type) which
matches the text in the "txtTkt" field on my open Access user form. I know
that the recordset exists, contains the correct data, and is open. Here is
my bad code that is within the class module for my form:

rst.CursorLocation = adUseClient
rst.Open "C:\Path\Somedata.dat", , adOpenStatic, adLockBatchOptimistic

X = Me.txtTkt

J = DLookup("Weight", rst, "Ticket = " & X)
 
Back
Top