Am I missing something or has my brain taken a early holiday?
how can "New Recordset" be bad?Code:Dim rstCountry As Recordset
Set rstCountry = New Recordset
(Invaild use of new?)
I need a vacation.
Printable View
Am I missing something or has my brain taken a early holiday?
how can "New Recordset" be bad?Code:Dim rstCountry As Recordset
Set rstCountry = New Recordset
(Invaild use of new?)
I need a vacation.
Try this mate:
Code:Dim rstCountry As New Recordset
I tried that too. Didn't work before. I think that I may have some setting wrong or something.
Recordset is probably public not creatable
nope it's Private
Still blows upCode:Private Sub FillCountryCombo()
Dim rstCountry As New Recordset
'Dim rstCountry As Recordset
'Set rstCountry = New Recordset
rstCountry.Open "SELECT DISTINCT Customers.Country FROM Customers ORDER BY Customers.Country", m_conn, adOpenForwardOnly, adLockReadOnly
cboCountry.Clear
cboCountry.AddItem ""
Do Until rstCountry.EOF
If Not IsNull(rstCountry![Country]) Then cboCountry.AddItem rstCountry![Country]
rstCountry.MoveNext
Loop
End Sub
Hmm, now i don't get it. :confused: Are you the designer of Recordset (sounds like database stuff and i don't know much about them). Because a private class wouldn't be available outside it's project..
Or do you mean the object is private? Sorry for not being a db expert :/ or whatever
If you have multiple libraries then you would have to specify what library you're using:
Code:Dim rs As New ADODB.Recordset
Thank you both for the help. I forgot "ADODB." in front of th word recordset (Thanks Serge). Can you tell me the difference, so I don't do that again (If you have the time)?
Thank you everyone and happy holidays!
I think he means there are multiple libraries referenced in your project that have something defined as a 'Recordset'
you can see your project references in the program menu, Project | References
Since they are both loaded, you have to qualify which library the recordset you want to use belongs to.
Dim rs as new ADODB.recordset explicitly tells VB which definition of recordset to use.
Your error sounds like VB was trying to use the other definition of recordset which was not an object that can be instantiated via the new operator