PC Review


Reply
Thread Tools Rate Thread

can't open recordset

 
 
=?Utf-8?B?RnJlZHJhdGVk?=
Guest
Posts: n/a
 
      31st Jul 2007
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      31st Jul 2007
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.

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


"Fredrated" <(E-Mail Removed)> wrote in message
news:8F3E359C-C407-4D1D-8EC0-(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?RnJlZHJhdGVk?=
Guest
Posts: n/a
 
      31st Jul 2007
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.

"Fredrated" wrote:

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form on open shows 2 records exist when recordset not open kfguardian Microsoft Access Form Coding 3 5th Jun 2008 04:55 PM
How do you doubleclick on a recordset to open recordset in form vi =?Utf-8?B?Si4gS2VnZ2VybG9yZA==?= Microsoft Access Form Coding 3 4th May 2007 09:56 PM
Open form with filter will not open to filtered recordset May via AccessMonster.com Microsoft Access Form Coding 1 4th Aug 2006 12:45 AM
How to open recordset =?Utf-8?B?TWFkaHVyaQ==?= Microsoft Access VBA Modules 1 13th Jul 2005 03:02 AM
Can't open recordset Robert Chapman Microsoft Access Getting Started 3 9th Feb 2004 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:54 PM.