DAO - Column rather than row

D

Dan

Please excuse me if this is a novice question. I am a bit away from my
confort zone with this as I am using a DAO link to interface with
Matlab.

I want to get values from an mdb file. I am looking to pull whole
columns of data at a time but have so far only managed to get each row.

q = hDB.CreateQueryDef('','SELECT * FROM tbl_QueryPeriod')
rs = q.OpenRecordset
data = rs.GetRows(rs.RecordCount)

Is there a way to get the whole column rather than a whole row?

Kind regards

Dan
 
J

Jeff Boyce

Dan

"Columns of data" is a concept that makes sense in a spreadsheet, but not in
a relational database like Access. In an Access table, a "column" (or
field) holds the value of a specific attribute of a record (row). For
example, in a table with person-related data, one column might be
DateOfBirth.

Retrieving all DatesOfBirth, without any reference to the record (row) that
"owns" them may be what you want to do. If so, you could use something
like:

SELECT DateOfBirth FROM tblPerson;

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Spencer

Try forcing the recordset to go to the end before you get the record count.

By the way did you post the entire procedure?
rs.MoveLast
data = rs.GetRows(rs.RecordCount)
 
Top