|
|
unusual Type Mismatch error
Hello
A piece of code that has been working OK for some time has suddenly fallen
over with a Type Mismatch error. The line in question is :
Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
I resolved the issue by removing the "Dim rs as Recordset" declaration and
everything has now gone back to normal, but I would be grateful if anyone
could throw any light on why this may have happened?
Regards.
|
|
0
|
|
|
|
Reply
|
Utf
|
10/17/2007 8:30:02 AM |
|
"Wez.k" <Wezk@discussions.microsoft.com> wrote in message
news:F6425549-5025-4EB7-9F1A-7CC3DFD4C312@microsoft.com...
> Hello
>
> A piece of code that has been working OK for some time has suddenly fallen
> over with a Type Mismatch error. The line in question is :
>
> Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
>
> I resolved the issue by removing the "Dim rs as Recordset" declaration and
> everything has now gone back to normal, but I would be grateful if anyone
> could throw any light on why this may have happened?
>
> Regards.
Try Dim rs As DAO.Recordset. If that works then I suspect you have a
reference to ADO. Either remove said reference, or move your DAO reference
so it is listed before ADO. Better still, use disambiguation in all your
declarations:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
etc.
|
|
0
|
|
|
|
Reply
|
Stuart
|
10/17/2007 8:55:27 AM
|
|
Thanks for your reply Stuart
I have checked my references and I have no ADO refs, but I do have the
'Microsoft DAO 3.6 Object Library'
However, I have tried your suggestion of 'Dim rs As DAO.Recordset' and it
does seem to have done the trick, thanks.
Regards
"Stuart McCall" wrote:
> "Wez.k" <Wezk@discussions.microsoft.com> wrote in message
> news:F6425549-5025-4EB7-9F1A-7CC3DFD4C312@microsoft.com...
> > Hello
> >
> > A piece of code that has been working OK for some time has suddenly fallen
> > over with a Type Mismatch error. The line in question is :
> >
> > Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
> >
> > I resolved the issue by removing the "Dim rs as Recordset" declaration and
> > everything has now gone back to normal, but I would be grateful if anyone
> > could throw any light on why this may have happened?
> >
> > Regards.
>
> Try Dim rs As DAO.Recordset. If that works then I suspect you have a
> reference to ADO. Either remove said reference, or move your DAO reference
> so it is listed before ADO. Better still, use disambiguation in all your
> declarations:
>
> Dim db As DAO.Database
> Dim qdf As DAO.QueryDef
>
> etc.
>
>
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
10/17/2007 9:26:05 AM
|
|
The ADO reference is named Microsoft ActiveX Data Objects 2.n Library (where
n will range from 0 to 8)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Wez.k" <Wezk@discussions.microsoft.com> wrote in message
news:77D30B59-9ACF-4F8F-AD94-854335E2A5F7@microsoft.com...
> Thanks for your reply Stuart
>
> I have checked my references and I have no ADO refs, but I do have the
> 'Microsoft DAO 3.6 Object Library'
>
> However, I have tried your suggestion of 'Dim rs As DAO.Recordset' and it
> does seem to have done the trick, thanks.
>
> Regards
>
> "Stuart McCall" wrote:
>>
>> Try Dim rs As DAO.Recordset. If that works then I suspect you have a
>> reference to ADO. Either remove said reference, or move your DAO
>> reference
>> so it is listed before ADO. Better still, use disambiguation in all your
>> declarations:
>>
>> Dim db As DAO.Database
>> Dim qdf As DAO.QueryDef
>>
>> etc.
>>
>>
>>>> "Wez.k" <Wezk@discussions.microsoft.com> wrote in message
>> news:F6425549-5025-4EB7-9F1A-7CC3DFD4C312@microsoft.com...
>> > Hello
>> >
>> > A piece of code that has been working OK for some time has suddenly
>> > fallen
>> > over with a Type Mismatch error. The line in question is :
>> >
>> > Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
>> >
>> > I resolved the issue by removing the "Dim rs as Recordset" declaration
>> > and
>> > everything has now gone back to normal, but I would be grateful if
>> > anyone
>> > could throw any light on why this may have happened?
>> >
>> > Regards.
|
|
0
|
|
|
|
Reply
|
Douglas
|
10/17/2007 12:40:32 PM
|
|
Thanks Douglas
I've looked again at my references and sure enough there it is...
Microsoft ActiveX Data Objects 2.1 Library
I'll try and remember that one, thanks again.
"Douglas J. Steele" wrote:
> The ADO reference is named Microsoft ActiveX Data Objects 2.n Library (where
> n will range from 0 to 8)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Wez.k" <Wezk@discussions.microsoft.com> wrote in message
> news:77D30B59-9ACF-4F8F-AD94-854335E2A5F7@microsoft.com...
> > Thanks for your reply Stuart
> >
> > I have checked my references and I have no ADO refs, but I do have the
> > 'Microsoft DAO 3.6 Object Library'
> >
> > However, I have tried your suggestion of 'Dim rs As DAO.Recordset' and it
> > does seem to have done the trick, thanks.
> >
> > Regards
> >
> > "Stuart McCall" wrote:
> >>
> >> Try Dim rs As DAO.Recordset. If that works then I suspect you have a
> >> reference to ADO. Either remove said reference, or move your DAO
> >> reference
> >> so it is listed before ADO. Better still, use disambiguation in all your
> >> declarations:
> >>
> >> Dim db As DAO.Database
> >> Dim qdf As DAO.QueryDef
> >>
> >> etc.
> >>
> >>
> >>>> "Wez.k" <Wezk@discussions.microsoft.com> wrote in message
> >> news:F6425549-5025-4EB7-9F1A-7CC3DFD4C312@microsoft.com...
> >> > Hello
> >> >
> >> > A piece of code that has been working OK for some time has suddenly
> >> > fallen
> >> > over with a Type Mismatch error. The line in question is :
> >> >
> >> > Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
> >> >
> >> > I resolved the issue by removing the "Dim rs as Recordset" declaration
> >> > and
> >> > everything has now gone back to normal, but I would be grateful if
> >> > anyone
> >> > could throw any light on why this may have happened?
> >> >
> >> > Regards.
>
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
10/17/2007 9:11:03 PM
|
|
|
4 Replies
445 Views
(page loaded in 0.089 seconds)
|
|
|
|
|
|
|
|
|