PC Review


Reply
Thread Tools Rate Thread

"CurrentDb" not recognized

 
 
=?Utf-8?B?QWxhbjQyOTc=?=
Guest
Posts: n/a
 
      25th Feb 2005
Six months ago, a VBA procedure worked fine. Now it doesn't work. The
offending line is:

Set oDbs = CurrentDb

When I run the procedure, "CurrentDb" is highlighted and the message is:

Function or interface marked as restricted, or the function uses an
Automation type not supported in Visual Basic.

What has happened?

Regards,
Alan
 
Reply With Quote
 
 
 
 
Gina
Guest
Posts: n/a
 
      25th Feb 2005
Hi Alan.

I had a similar problem yesterday and the days before and that's what I have
done

1. I set reference to DAO 3.6 in the vba environment
2. declared the db As DAO.DB and the recSet as DAO.Recordset

and it worked ... good luck
Gina

"Alan4297" <(E-Mail Removed)> schrieb im Newsbeitrag
news:34A38BE2-BF9B-4E67-9ECF-(E-Mail Removed)...
> Six months ago, a VBA procedure worked fine. Now it doesn't work. The
> offending line is:
>
> Set oDbs = CurrentDb
>
> When I run the procedure, "CurrentDb" is highlighted and the message is:
>
> Function or interface marked as restricted, or the function uses an
> Automation type not supported in Visual Basic.
>
> What has happened?
>
> Regards,
> Alan



 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      25th Feb 2005
Alan4297 wrote:

>Six months ago, a VBA procedure worked fine. Now it doesn't work. The
>offending line is:
>
> Set oDbs = CurrentDb
>
>When I run the procedure, "CurrentDb" is highlighted and the message is:
>
>Function or interface marked as restricted, or the function uses an
>Automation type not supported in Visual Basic.



It sounds like you moved the program to a different machine
with different libraries. Or, maybe you created a new mdb
and copied everything from the original program.

Either way, your references are messed up. Go to any VBA
module and use Tools - References to uncheck the unneeded
ones (ActiveX...?, the 2.5 - 3.5 Compatibility ..., ADO,
???) and set the ones you do need, especially DAO.

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
Wayne Morgan
Guest
Posts: n/a
 
      25th Feb 2005
Gina is on the right track; however, if it worked then now doesn't it sounds
as if your references have been changed or broken. First, when declaring a
DAO object in Access 2000 or newer, specify the library in the declaration
(i.e. Dim oDbs As DAO.Database). This is because Access uses the references
in the order that the checked items are listed in the references window (in
the code editor go to Tools|References). There are up and down arrows to
change the order, but if you specify the library being used, then the order
doesn't matter. The reason for the problem is that there are objects in both
ADO and DAO with the same name, but they behave differently.

If a reference has become broken, you need to fix it. The reference that is
broken may or may not be to the library that is causing you problems, but
fixing the broken reference will usually solve the problem anyway. You will
find a good explanation of this problem here:

http://members.iinet.net.au/~allenbrowne/ser-38.html

--
Wayne Morgan
MS Access MVP


"Alan4297" <(E-Mail Removed)> wrote in message
news:34A38BE2-BF9B-4E67-9ECF-(E-Mail Removed)...
> Six months ago, a VBA procedure worked fine. Now it doesn't work. The
> offending line is:
>
> Set oDbs = CurrentDb
>
> When I run the procedure, "CurrentDb" is highlighted and the message is:
>
> Function or interface marked as restricted, or the function uses an
> Automation type not supported in Visual Basic.
>
> What has happened?



 
Reply With Quote
 
=?Utf-8?B?QWxhbjQyOTc=?=
Guest
Posts: n/a
 
      25th Feb 2005
Hi Gina,

That worked fine. Thanks.

Regards,
Alan

"Gina" wrote:

> Hi Alan.
>
> I had a similar problem yesterday and the days before and that's what I have
> done
>
> 1. I set reference to DAO 3.6 in the vba environment
> 2. declared the db As DAO.DB and the recSet as DAO.Recordset
>
> and it worked ... good luck
> Gina
>
> "Alan4297" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:34A38BE2-BF9B-4E67-9ECF-(E-Mail Removed)...
> > Six months ago, a VBA procedure worked fine. Now it doesn't work. The
> > offending line is:
> >
> > Set oDbs = CurrentDb
> >
> > When I run the procedure, "CurrentDb" is highlighted and the message is:
> >
> > Function or interface marked as restricted, or the function uses an
> > Automation type not supported in Visual Basic.
> >
> > What has happened?
> >
> > Regards,
> > Alan

>
>
>

 
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
CurrentDb.OpenRecordset & "Too Few Parameters expected 1". RSteph Microsoft Access VBA Modules 6 12th May 2009 02:39 PM
CurrentDb.OpenRecordset & "Too Few Parameters expected 1". RSteph Microsoft Access VBA Modules 0 12th May 2009 01:50 PM
Hard drive not recognized by "MY COMPUTER" or "WINDOWS EXPLORER" traderktubes Windows XP Help 1 14th Oct 2008 07:17 AM
"USB Device Not Recognized" in USB2 ports but is recognized on USB1ports yawnmoth Windows XP Hardware 4 23rd Mar 2008 03:11 PM
"MS Natural Keyboard" --> "USB Device Not Recognized" =?Utf-8?B?SldKUA==?= Windows XP Help 0 8th Jun 2004 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.