View Single Post
 
Old 05-26-2011, 07:54 AM
Joe Patrick Joe Patrick is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default thank you, macropod!

Thank you so much!

Unfortunately, I can't get the rest of it to work either. I suppose it may be outdated but a couple of things don't seem right to me.

-I changed 'listbox1' to 'combobox1' since that's what i'm using
-If i'm not supposed to be referring to DAO when in Excel 2007 then is this correct?
-I get runtime error 3170 - 'could not find installable ISAM

Private Sub UserForm_Initialize()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NoOfRecords As Long

Set db = OpenDatabase("U:\TPCentral_Too\PE_GC_list.xls", False, False, "Excel 12.0")
Set rs = db.OpenRecordset("SELECT * FROM 'PEdatabase'")

With rs
.MoveLast
NoOfRecords = .RecordCount
.MoveFirst
End With

ComboBox1.ColumnCount = rs.Fields.Count
ComboBox1.Column = rs.GetRows(NoOfRecords)

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub
Reply With Quote