Need to read one record - Is there an alternative to using RecordS

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

I need to simply read one record from a single table in Access using VBA.

Is there an alternative to using a RecordSet?

Is there a simpler method that doesn't require as many lines of code?

Thanks,
Brad
 
Brad said:
I need to simply read one record from a single table in Access using VBA.

Is there an alternative to using a RecordSet?

Is there a simpler method that doesn't require as many lines of code?

Thanks,
Brad


Read about the Dlookup function in Help.

Phil, London
 
Brad

Do you know which record? Do you have criteria to help you select that "one
record"?

Or are you looking for any record, chosen at random?

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Jeff,

Thanks for your help.

Yes, I know the key for the one record. I can make the RecordSet method
work, it just seems like a lot of lines of code for retrieving a single
record.

Thanks again,
Brad
 
Brad said:
I need to simply read one record from a single table in Access using VBA.

Is there an alternative to using a RecordSet?

Is there a simpler method that doesn't require as many lines of code?

I count two lines here:

dim rstData as dao.RecordSet

set rstData = currentdb.OpenRecordSet("select * from tblCustomer where id =
123")

That's not really a lot of code...is it?
 
Albert,

I guess you are right. Two lines aren't terrible.

Being a fairly new Access user, I am still adjusting to using RecordSets to
read data while I can add a row with just one statement. I was just
wondering if I was missing something, such as a way to read one record
without using a RecordSet.

Thanks for your feedback.


Brad
 
Back
Top