PC Review


Reply
Thread Tools Rate Thread

"Compile Error: Function or Interface Marked as Restricted..."

 
 
Ron B.
Guest
Posts: n/a
 
      24th Feb 2005
I've recently converted an Access97 file to Access2003. During the
conversion, there were "compilation errors" due to old DAO syntax no
longer supported.

I hired an Access programer to fiddle with the code and he got it
working. Been using the program for over a month.... when we just
started getting the following error:

"Compile Error: Function or Interface Marked as Restricted..."

On the following code:
#################
Dim mydb As Database, MyQuery As QueryDef
If IsNull(GreigePattern) Then
Exit Sub
End If
Set mydb = CurrentDb()
'Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
If IsNull(mydb.QueryDefs("Change Dept")) Then
Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
Else
Set MyQuery = mydb.QueryDefs("Change Dept")
End If
' Set SQL property.
MyQuery.SQL = "UPDATE DISTINCTROW GreigePattern SET
GreigePattern!Department = [prmDepartment] WHERE
GreigePattern!GreigeNumber = [prmGreige] AND GreigePattern!KnitterCode =
[prmKnitter];"
MyQuery.Parameters("prmDepartment") =
[Forms]![frmColorRequests]![cboDepartment]
MyQuery.Parameters("prmGreige") = [Forms]![frmColorRequests]![GreigeNumber]
MyQuery.Parameters("prmKnitter") = [Forms]![frmColorRequests]![cboKnitter]
MyQuery.Execute ' Invoke query.
MyQuery.Close ' Close query.
mydb.DeleteQueryDef ("Change Dept") ' Delete query.
#############

The error is with the very lastline: "DeleteQueryDef"

This type of code, with the DeleteQueryDef is used in about 5 other
places in the program. they all error.

Any Ideas??? Especially, since it has been working just fine, till a
day or two ago... no updates of any kind have been made either...
that I know of.

Thanks!
Ron
 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      24th Feb 2005

The mystery is not why it stopped working, but how it ever worked at all in
Access 2003. It shouldn't. It should be changed to ...

mydb.QueryDefs.Delete "Change Dept"

--
Brendan Reynolds (MVP)

"Ron B." <(E-Mail Removed)> wrote in message
news:cvl0e3$co0$0$(E-Mail Removed)...
> I've recently converted an Access97 file to Access2003. During the
> conversion, there were "compilation errors" due to old DAO syntax no
> longer supported.
>
> I hired an Access programer to fiddle with the code and he got it working.
> Been using the program for over a month.... when we just started getting
> the following error:
>
> "Compile Error: Function or Interface Marked as Restricted..."
>
> On the following code:
> #################
> Dim mydb As Database, MyQuery As QueryDef
> If IsNull(GreigePattern) Then
> Exit Sub
> End If
> Set mydb = CurrentDb()
> 'Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
> If IsNull(mydb.QueryDefs("Change Dept")) Then
> Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
> Else
> Set MyQuery = mydb.QueryDefs("Change Dept")
> End If
> ' Set SQL property.
> MyQuery.SQL = "UPDATE DISTINCTROW GreigePattern SET
> GreigePattern!Department = [prmDepartment] WHERE
> GreigePattern!GreigeNumber = [prmGreige] AND GreigePattern!KnitterCode =
> [prmKnitter];"
> MyQuery.Parameters("prmDepartment") =
> [Forms]![frmColorRequests]![cboDepartment]
> MyQuery.Parameters("prmGreige") =
> [Forms]![frmColorRequests]![GreigeNumber]
> MyQuery.Parameters("prmKnitter") = [Forms]![frmColorRequests]![cboKnitter]
> MyQuery.Execute ' Invoke query.
> MyQuery.Close ' Close query.
> mydb.DeleteQueryDef ("Change Dept") ' Delete query.
> #############
>
> The error is with the very lastline: "DeleteQueryDef"
>
> This type of code, with the DeleteQueryDef is used in about 5 other places
> in the program. they all error.
>
> Any Ideas??? Especially, since it has been working just fine, till a
> day or two ago... no updates of any kind have been made either... that
> I know of.
>
> Thanks!
> Ron



 
Reply With Quote
 
Ron B.
Guest
Posts: n/a
 
      24th Feb 2005
THANK YOU KIND SIR!

I changed the code and viola! it works like a charm.

Wierd... it TRULY DID work for about 3 weeks with the original
command... I don't understand. But.... I don't care either.

Truly appreciated!
Ron


Brendan Reynolds wrote:

> The mystery is not why it stopped working, but how it ever worked at all in
> Access 2003. It shouldn't. It should be changed to ...
>
> mydb.QueryDefs.Delete "Change Dept"
>

 
Reply With Quote
 
david epsom dot com dot au
Guest
Posts: n/a
 
      25th Feb 2005
Cool!

Not 'Method or Function not found', but 'Marked as Restricted'
- ie only for use with the DAO2535 type library
(And note that the display syntax parser still recognizes it!)

Since 'restricted' means only that VBA can't bind to the interface,
I'm wondering if removing the DAO2535 type library failed to
correctly mark the code as uncompiled?

(david)


"Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message
news:(E-Mail Removed)...
>
> The mystery is not why it stopped working, but how it ever worked at all
> in Access 2003. It shouldn't. It should be changed to ...
>
> mydb.QueryDefs.Delete "Change Dept"
>
> --
> Brendan Reynolds (MVP)
>
> "Ron B." <(E-Mail Removed)> wrote in message
> news:cvl0e3$co0$0$(E-Mail Removed)...
>> I've recently converted an Access97 file to Access2003. During the
>> conversion, there were "compilation errors" due to old DAO syntax no
>> longer supported.
>>
>> I hired an Access programer to fiddle with the code and he got it
>> working. Been using the program for over a month.... when we just
>> started getting the following error:
>>
>> "Compile Error: Function or Interface Marked as Restricted..."
>>
>> On the following code:
>> #################
>> Dim mydb As Database, MyQuery As QueryDef
>> If IsNull(GreigePattern) Then
>> Exit Sub
>> End If
>> Set mydb = CurrentDb()
>> 'Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
>> If IsNull(mydb.QueryDefs("Change Dept")) Then
>> Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
>> Else
>> Set MyQuery = mydb.QueryDefs("Change Dept")
>> End If
>> ' Set SQL property.
>> MyQuery.SQL = "UPDATE DISTINCTROW GreigePattern SET
>> GreigePattern!Department = [prmDepartment] WHERE
>> GreigePattern!GreigeNumber = [prmGreige] AND GreigePattern!KnitterCode =
>> [prmKnitter];"
>> MyQuery.Parameters("prmDepartment") =
>> [Forms]![frmColorRequests]![cboDepartment]
>> MyQuery.Parameters("prmGreige") =
>> [Forms]![frmColorRequests]![GreigeNumber]
>> MyQuery.Parameters("prmKnitter") =
>> [Forms]![frmColorRequests]![cboKnitter]
>> MyQuery.Execute ' Invoke query.
>> MyQuery.Close ' Close query.
>> mydb.DeleteQueryDef ("Change Dept") ' Delete query.
>> #############
>>
>> The error is with the very lastline: "DeleteQueryDef"
>>
>> This type of code, with the DeleteQueryDef is used in about 5 other
>> places in the program. they all error.
>>
>> Any Ideas??? Especially, since it has been working just fine, till a
>> day or two ago... no updates of any kind have been made either... that
>> I know of.
>>
>> Thanks!
>> Ron

>
>



 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      25th Feb 2005
I think you know more about that kind of thing than I do, David, so if you
think that's a likely explanation, my guess would be that you're probably
right! :-)

--
Brendan Reynolds (MVP)

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:%23Hkz$$(E-Mail Removed)...
> Cool!
>
> Not 'Method or Function not found', but 'Marked as Restricted'
> - ie only for use with the DAO2535 type library
> (And note that the display syntax parser still recognizes it!)
>
> Since 'restricted' means only that VBA can't bind to the interface,
> I'm wondering if removing the DAO2535 type library failed to
> correctly mark the code as uncompiled?
>
> (david)
>
>
> "Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message
> news:(E-Mail Removed)...
>>
>> The mystery is not why it stopped working, but how it ever worked at all
>> in Access 2003. It shouldn't. It should be changed to ...
>>
>> mydb.QueryDefs.Delete "Change Dept"
>>
>> --
>> Brendan Reynolds (MVP)
>>
>> "Ron B." <(E-Mail Removed)> wrote in message
>> news:cvl0e3$co0$0$(E-Mail Removed)...
>>> I've recently converted an Access97 file to Access2003. During the
>>> conversion, there were "compilation errors" due to old DAO syntax no
>>> longer supported.
>>>
>>> I hired an Access programer to fiddle with the code and he got it
>>> working. Been using the program for over a month.... when we just
>>> started getting the following error:
>>>
>>> "Compile Error: Function or Interface Marked as Restricted..."
>>>
>>> On the following code:
>>> #################
>>> Dim mydb As Database, MyQuery As QueryDef
>>> If IsNull(GreigePattern) Then
>>> Exit Sub
>>> End If
>>> Set mydb = CurrentDb()
>>> 'Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
>>> If IsNull(mydb.QueryDefs("Change Dept")) Then
>>> Set MyQuery = mydb.CreateQueryDef("Change Dept") ' Create query.
>>> Else
>>> Set MyQuery = mydb.QueryDefs("Change Dept")
>>> End If
>>> ' Set SQL property.
>>> MyQuery.SQL = "UPDATE DISTINCTROW GreigePattern SET
>>> GreigePattern!Department = [prmDepartment] WHERE
>>> GreigePattern!GreigeNumber = [prmGreige] AND GreigePattern!KnitterCode =
>>> [prmKnitter];"
>>> MyQuery.Parameters("prmDepartment") =
>>> [Forms]![frmColorRequests]![cboDepartment]
>>> MyQuery.Parameters("prmGreige") =
>>> [Forms]![frmColorRequests]![GreigeNumber]
>>> MyQuery.Parameters("prmKnitter") =
>>> [Forms]![frmColorRequests]![cboKnitter]
>>> MyQuery.Execute ' Invoke query.
>>> MyQuery.Close ' Close query.
>>> mydb.DeleteQueryDef ("Change Dept") ' Delete query.
>>> #############
>>>
>>> The error is with the very lastline: "DeleteQueryDef"
>>>
>>> This type of code, with the DeleteQueryDef is used in about 5 other
>>> places in the program. they all error.
>>>
>>> Any Ideas??? Especially, since it has been working just fine, till a
>>> day or two ago... no updates of any kind have been made either...
>>> that I know of.
>>>
>>> Thanks!
>>> Ron

>>
>>

>
>



 
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
"Compile Error: ByRef argument type mismatch" when calling my function from another module ker_01 Microsoft Excel Programming 2 14th Aug 2008 03:53 PM
still getting "Internet Explorer has restricted this file from showing active content" even though marked as safe ari Windows XP Help 3 13th Feb 2007 10:59 PM
function "compile error msg: procedure too large" RASHESH Microsoft Excel Programming 4 13th May 2005 04:48 AM
Function or Interface marked as restricted..in a COM wrapper =?Utf-8?B?TmlrbGFz?= Microsoft VB .NET 0 1st Dec 2004 08:45 AM
"Compile Error: Function or Interface Marked as Restricted..." =?Utf-8?B?TU0=?= Microsoft Access VBA Modules 2 3rd Oct 2004 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:10 PM.