J
Jade
Hi,
I used the following code which worked fine a few days ago and now
doesn't pull the data from into the listbox.
I've checked the reference, syntax, and just can't understand why it
isn't working. I have it on my computer at home and it works fine yet
at work (where it worked until just recently) it doesn't.
Any suggestions as to why this is occuring ...or if someone has an
alternate method to pull data from a range in an excel sheet to a
listbox that would be great as well. Basically any help would be
great.
here it is:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NumRecords As Long
Set db = OpenDatabase("C:\Test\Book1.xls", False, False, "Excel
8.0")
Set rs = db.OpenRecordset("SELECT * FROM TblRng")
With rs
.MoveLast
NumRecords = .RecordCount
.MoveFirst
End With
ListBox1.ColumnCount = rs.Fields.Count
ListBox1.Column = rs.GetRows(NumRecords)
rs.Close
db.Close
Set rs = Nothing
Set db=nothing
Thanks
I used the following code which worked fine a few days ago and now
doesn't pull the data from into the listbox.
I've checked the reference, syntax, and just can't understand why it
isn't working. I have it on my computer at home and it works fine yet
at work (where it worked until just recently) it doesn't.
Any suggestions as to why this is occuring ...or if someone has an
alternate method to pull data from a range in an excel sheet to a
listbox that would be great as well. Basically any help would be
great.
here it is:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NumRecords As Long
Set db = OpenDatabase("C:\Test\Book1.xls", False, False, "Excel
8.0")
Set rs = db.OpenRecordset("SELECT * FROM TblRng")
With rs
.MoveLast
NumRecords = .RecordCount
.MoveFirst
End With
ListBox1.ColumnCount = rs.Fields.Count
ListBox1.Column = rs.GetRows(NumRecords)
rs.Close
db.Close
Set rs = Nothing
Set db=nothing
Thanks