dlookup

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)
 
R

R. Choate

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)
 

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

Top