Re: Problem opening Recordsets
am 16.11.2007 05:28:22 von Allen Browne
Try replacing the first 2 lines with:
Dim mydb As DAO.Database
Dim myrs As DAO.Recordset
so you are explicit about the objects you want.
If that doesn't work, it may still be an issue with References. Uncheck the
DAO reference. Save. Close Access. Unregister the DAO library, and
re-register it. Then open the database, and add the DAO reference again. For
details on how to use regsvr32, see:
http://allenbrowne.com/ser-38.html
You may be able to drop some of the other references as well.
If that still doesn't work, post the error number and exact message, and the
text of line that gives the error.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"KC-Mass" wrote in message
news:3P-dne7sFOxtlKDanZ2dnUVZ_hisnZ2d@comcast.com...
>I failed to mention that I am running Access 2002 on Windows XP.
>
> "KC-Mass" wrote in message
> news:Lcydnb6DGNQilaDanZ2dnUVZ_rOqnZ2d@comcast.com...
>>I recently had a motherboard failure that took the drive with it. When I
>>finished reloading everything on the new system, I have a new problem.
>>
>> I can not seem to open a simple recordset in VBA. The following code
>> fails at line 5.
>>
>> Sub WalkFile()
>> Dim mydb As Database
>> Dim myrs As Recordset
>> Set mydb = CurrentDb
>> Set myrs = DB.OpenRecordset("tblAll", dbOpenDynaset)
>> Do While Not myrs.EOF
>> Debug.Print proccode
>> myrs.MoveNext
>> Loop
>> End Sub
>>
>>
>> run time error 424
>> Object Required
>>
>>
>> I checked references but i do not know if they are the same as they were.
>> This is what they are:
>>
>> Visual Basic for applications
>> Microsoft Access 10.0 Object Library
>> Microsoft DAO 3.6 Object Library
>> Microsoft Visual Basic for extensibility
>> Microsoft Data Source Interfaces
>>
>>
>> Any Ideas appreciated.
>>
>> Thx
>> Kevin
>>
>>
>
>
Re: Problem opening Recordsets
am 16.11.2007 06:50:20 von Stuart McCall
"KC-Mass" wrote in message
news:Lcydnb6DGNQilaDanZ2dnUVZ_rOqnZ2d@comcast.com...
>I recently had a motherboard failure that took the drive with it. When I
>finished reloading everything on the new system, I have a new problem.
>
> I can not seem to open a simple recordset in VBA. The following code
> fails at line 5.
>
> Sub WalkFile()
> Dim mydb As Database
> Dim myrs As Recordset
> Set mydb = CurrentDb
> Set myrs = DB.OpenRecordset("tblAll", dbOpenDynaset)
> Do While Not myrs.EOF
> Debug.Print proccode
> myrs.MoveNext
> Loop
> End Sub
>
>
> run time error 424
> Object Required
>
>
> I checked references but i do not know if they are the same as they were.
> This is what they are:
>
> Visual Basic for applications
> Microsoft Access 10.0 Object Library
> Microsoft DAO 3.6 Object Library
> Microsoft Visual Basic for extensibility
> Microsoft Data Source Interfaces
>
>
> Any Ideas appreciated.
>
> Thx
> Kevin
You are declaring mydb to be a database object, but referring to DB on the
next line. Change the line to read:
Set myrs = mydb.OpenRecordset("tblAll", dbOpenDynaset)
Problem opening Recordsets
am 16.11.2007 07:05:58 von Kc-Mass
I recently had a motherboard failure that took the drive with it. When I
finished reloading everything on the new system, I have a new problem.
I can not seem to open a simple recordset in VBA. The following code fails
at line 5.
Sub WalkFile()
Dim mydb As Database
Dim myrs As Recordset
Set mydb = CurrentDb
Set myrs = DB.OpenRecordset("tblAll", dbOpenDynaset)
Do While Not myrs.EOF
Debug.Print proccode
myrs.MoveNext
Loop
End Sub
run time error 424
Object Required
I checked references but i do not know if they are the same as they were.
This is what they are:
Visual Basic for applications
Microsoft Access 10.0 Object Library
Microsoft DAO 3.6 Object Library
Microsoft Visual Basic for extensibility
Microsoft Data Source Interfaces
Any Ideas appreciated.
Thx
Kevin
Re: Problem opening Recordsets
am 16.11.2007 07:11:00 von Kc-Mass
I failed to mention that I am running Access 2002 on Windows XP.
"KC-Mass" wrote in message
news:Lcydnb6DGNQilaDanZ2dnUVZ_rOqnZ2d@comcast.com...
>I recently had a motherboard failure that took the drive with it. When I
>finished reloading everything on the new system, I have a new problem.
>
> I can not seem to open a simple recordset in VBA. The following code
> fails at line 5.
>
> Sub WalkFile()
> Dim mydb As Database
> Dim myrs As Recordset
> Set mydb = CurrentDb
> Set myrs = DB.OpenRecordset("tblAll", dbOpenDynaset)
> Do While Not myrs.EOF
> Debug.Print proccode
> myrs.MoveNext
> Loop
> End Sub
>
>
> run time error 424
> Object Required
>
>
> I checked references but i do not know if they are the same as they were.
> This is what they are:
>
> Visual Basic for applications
> Microsoft Access 10.0 Object Library
> Microsoft DAO 3.6 Object Library
> Microsoft Visual Basic for extensibility
> Microsoft Data Source Interfaces
>
>
> Any Ideas appreciated.
>
> Thx
> Kevin
>
>