Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2007

Tip: Looking for answers? Try searching our database.

can't open recordset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fredrated - 31 Jul 2007 19:06 GMT
I've used this code a thousand times, but now I get a 'type mismatch' error
at the command 'set rs  = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)'.  
This is in a new access database.
(yeah I know, currentdb is temporary but it works)

Private Sub Command0_Click()
Dim rs As Recordset
Dim strSQL As String

strSQL = "SELECT ACTIAImport.* FROM ACTIAImport;"

Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
'etcetc

End Sub

As in every other case, I have tools>references:
Visual Basic for Applications
Microsoft Access 10.0 object library
Microsoft DAO 3.6 object library
OLE Automation
Micorsoft ActiveX Data Objects 2.8 Library

Compile doesn't have any problems with it, and when I copy the code into a
working database it works fine.

What am I missing?

Thanks
Douglas J. Steele - 31 Jul 2007 19:18 GMT
Even though you have DAO higher in the list than ADO, see whether changing

Dim rs As Recordset

to

Dim rs As DAO.Recordset

makes a difference.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I've used this code a thousand times, but now I get a 'type mismatch'
> error
[quoted text clipped - 27 lines]
>
> Thanks
Fredrated - 31 Jul 2007 19:22 GMT
Never mind, I just opened a new database, copied what I want into it and it
now works fine.  I ran compact/repair on the original failing database but
that didn't help.  Who knows why it fails, probably something internal got
messed up.

> I've used this code a thousand times, but now I get a 'type mismatch' error
> at the command 'set rs  = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)'.  
[quoted text clipped - 26 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.