473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

A97 permissions help example does not compile

MLH
Invalid qualifier error displays at compile time on this A97 example
from Permissions Property HELP. What's wrong with the strContainerName
assignment line? (6th line)

Sub SetDocPermissions(docUnknown As Document)
Dim strContainerName As String
' Set UserName property to valid existing group account.
docUnknown.UserName = "Marketers"
' Get value of Container property.
strContainerName = docUnknown.Container.Name
Select Case strContainerName
Case "Forms"
' Set permissions for Form Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecFrmRptWriteDef
Case "Reports"
' Set permissions for Report Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecFrmRptExecute
Case "Scripts"
' Set permissions for Script Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecMacWriteDef
Case "Modules"
' Set permissions for Module Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecModReadDef
Case Else
Exit Sub
End Select
End Sub

Oct 15 '06 #1
13 1675
MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)
It's a typographical error. The Container property is a string, not an
object, so it doesn't have a Name property. Change that line of code to this:
strContainerName = docUnknown.Container

--
Message posted via http://www.accessmonster.com

Oct 16 '06 #2
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:
MLH wrote:
>What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a string, not
an object, so it doesn't have a Name property. Change that line of
code to this:

strContainerName = docUnknown.Container
Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

--
Lyle Fairfield
Oct 16 '06 #3

Don't you just love Microsoft.

--

Terry Kreft
"Lyle Fairfield" <ly***********@aim.comwrote in message
news:Xn*********************************@216.221.8 1.119...
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:
MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)
It's a typographical error. The Container property is a string, not
an object, so it doesn't have a Name property. Change that line of
code to this:

strContainerName = docUnknown.Container

Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

--
Lyle Fairfield

Oct 16 '06 #4
Lyle Fairfield <ly***********@aim.comwrote in
news:Xn*********************************@216.221.8 1.119:
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:
>MLH wrote:
>>What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a string,
not an object, so it doesn't have a Name property. Change that
line of code to this:

strContainerName = docUnknown.Container

Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!
Um, show me any MS example code that suggests anything else.

It's important to not confuse:

Containers(0).Name

with

Document.Container

Now, by analogy, this is basically a Parent property, and is perhaps
not parallel to other objects, but I don't see what the issue is. If
you use Intellisense and read the Help file, you'll get it right.

That's obviously why MLH can't get it right, but that oughtn't be an
obstacle to anyone with any sense.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 16 '06 #5
Lyle Fairfield wrote:
Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!
The Microsoft programmers were just checking to see if we were paying
attention.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 16 '06 #6
David W. Fenton wrote:
Lyle Fairfield <ly***********@aim.comwrote in
news:Xn*********************************@216.221.8 1.119:
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:
MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a string,
not an object, so it doesn't have a Name property. Change that
line of code to this:

strContainerName = docUnknown.Container
Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

Um, show me any MS example code that suggests anything else.
You could always look at the top post in this thread
or
http://msdn.microsoft.com/archive/de.../D2/S5A27E.asp

Oh, wait, you've plonked me so you won't see this.

Oh wait again, how did you reply to my post if you plonked me? Gee, I'm
so confused!

Oct 16 '06 #7
Granny Spitz via AccessMonster.com wrote:
Lyle Fairfield wrote:
Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

The Microsoft programmers were just checking to see if we were paying
attention.
I wasn't paying attention. Your post enlightened me.

Oct 16 '06 #8

It is a stupid and counter-intuitive design decision though.

--

Terry Kreft
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in message
news:Xn*********************************@127.0.0.1 ...
Lyle Fairfield <ly***********@aim.comwrote in
news:Xn*********************************@216.221.8 1.119:
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:
MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a string,
not an object, so it doesn't have a Name property. Change that
line of code to this:

strContainerName = docUnknown.Container
Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

Um, show me any MS example code that suggests anything else.

It's important to not confuse:

Containers(0).Name

with

Document.Container

Now, by analogy, this is basically a Parent property, and is perhaps
not parallel to other objects, but I don't see what the issue is. If
you use Intellisense and read the Help file, you'll get it right.

That's obviously why MLH can't get it right, but that oughtn't be an
obstacle to anyone with any sense.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Oct 16 '06 #9
Lyle Fairfield wrote:
>The Microsoft programmers were just checking to see if we were paying
attention.

I wasn't paying attention. Your post enlightened me.
Then I'm very pleased to start repaying the debt I owe you for all your posts
that have enlightened me. Only 10,000 more to go ... <g>

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 16 '06 #10
"Terry Kreft" <te*********@mps.co.ukwrote in
news:EL******************************@eclipse.net. uk:
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in message
news:Xn*********************************@127.0.0.1 ...
>Lyle Fairfield <ly***********@aim.comwrote in
news:Xn*********************************@216.221. 81.119:
"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:

MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a
string, not an object, so it doesn't have a Name property.
Change that line of code to this:

strContainerName = docUnknown.Container

Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

Um, show me any MS example code that suggests anything else.

It's important to not confuse:

Containers(0).Name

with

Document.Container

Now, by analogy, this is basically a Parent property, and is
perhaps not parallel to other objects, but I don't see what the
issue is. If you use Intellisense and read the Help file, you'll
get it right.

That's obviously why MLH can't get it right, but that oughtn't be
an obstacle to anyone with any sense.

It is a stupid and counter-intuitive design decision though.
I don't see it.

It really isn't at all like the .Parent property of a form or
report, which exists only when the form/report is open.

The objects in document containers don't really exist. You're
reading the definitions from the data store, so I don't know why the
parent of a document should return a reference of object type
instead of a string.

Documents just aren't like other objects in Access.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 17 '06 #11
Of course they are like any other object. An object in COM terms is
defined by it's interface not by what it is created from.

This was a counter-intuitive design decision because it would be natural to
assume that if you derive an object from a collection of objects then if
that derived object has a property which is named as the singular of it's
parent collection then that property is a pointer back to the collection.

It was a stupid decision because if the Container property had been
implemented as a pointer back to the document container object it would have
made navigation through the collection much more fluid, and utilising a Name
property on this theoretical object would have achieved the same purpose as
is currently offered by the Container property.
--

Terry Kreft
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in message
news:Xn*********************************@127.0.0.1 ...
"Terry Kreft" <te*********@mps.co.ukwrote in
news:EL******************************@eclipse.net. uk:
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in message
news:Xn*********************************@127.0.0.1 ...
Lyle Fairfield <ly***********@aim.comwrote in
news:Xn*********************************@216.221.8 1.119:

"Granny Spitz via AccessMonster.com" <u26473@uwewrote in
news:67d345dfca650@uwe:

MLH wrote:
What's wrong with the strContainerName
assignment line? (6th line)

It's a typographical error. The Container property is a
string, not an object, so it doesn't have a Name property.
Change that line of code to this:

strContainerName = docUnknown.Container

Dim c As Container
Dim d As Document
Set c = DBEngine(0)(0).Containers("Forms")
Debug.Print VarType(c) '9 (object)
Set d = c.Documents(0)
Debug.Print VarType(d.Container) '8 (string)

Ohhhh yeah!

Um, show me any MS example code that suggests anything else.

It's important to not confuse:

Containers(0).Name

with

Document.Container

Now, by analogy, this is basically a Parent property, and is
perhaps not parallel to other objects, but I don't see what the
issue is. If you use Intellisense and read the Help file, you'll
get it right.

That's obviously why MLH can't get it right, but that oughtn't be
an obstacle to anyone with any sense.
It is a stupid and counter-intuitive design decision though.

I don't see it.

It really isn't at all like the .Parent property of a form or
report, which exists only when the form/report is open.

The objects in document containers don't really exist. You're
reading the definitions from the data store, so I don't know why the
parent of a document should return a reference of object type
instead of a string.

Documents just aren't like other objects in Access.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Oct 17 '06 #12
"Terry Kreft" <te*********@mps.co.ukwrote in
news:Dd********************@eclipse.net.uk:
It was a stupid decision because if the Container property had
been implemented as a pointer back to the document container
object it would have made navigation through the collection much
more fluid, and utilising a Name property on this theoretical
object would have achieved the same purpose as is currently
offered by the Container property.
Well, whatever.

I've never had any problems with Containers because I've always
modelled my code for using them on the examples in the Access help
file.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 17 '06 #13
"Terry Kreft" <te*********@mps.co.ukwrote in
news:Dd********************@eclipse.net.uk:
It was a stupid decision because if the Container property had
been implemented as a pointer back to the document container
object it would have made navigation through the collection much
more fluid, and utilising a Name property on this theoretical
object would have achieved the same purpose as is currently
offered by the Container property.
I've rethought this whole issue, and decided that I may agree to
you.

In the model you are proposing you could do this:

MyForm.Container

and get a reference to the parent container.

But that reference doesn't mean anything anywhere in Access. It
would only be useful if you could refer to something by name when
you didn't know what the type of that thing was. I can't think of
any context where we can utilize an Access object (not a Jet object)
interchangeable without needing to know its parent container.

Likewise, the subroutine posted by MLH took a Document object as its
sole parameter. There is actually no way in Access to do a:

Dim doc As Document

Set doc = [something that returns a document-type ref]

without doing it off of a container object. This is because there
are no functions or properties anywhere in Access that return a
reference of type Document except the children of containers.

Put another way, you can't get to a document without going through
the parent container. This means you have to know the parent
container to get to the document in the first place, so you already
know the name of the parent container in any context in which you
could even attempt to evaluate the value of doc.Container or of the
hypothetical doc.Container.Name.

Now, I don't know how you could unify these namespaces in Access so
that you could just refer to something by name without a container
identified, but it seems that you are claiming that doing it that
way is somehow both inconsistent with the rest of Access and
undesirable. While I might agree that it's undesirable, it is, in
fact, completely consistent with the rest of Access. Even in A2K and
above where you have CurrentProject.AllForms, etc., you still have
to go through the parent container, it's just a shortcut for
CurrentDB.Containers!Forms. It's certainly easier to understand and
a nice feature, but it doesn't actually fix the problem you seem to
me to be raising.

Indeed, it apparently returns a reference of type AccessObject,
instead of one specific to the collection/container, and it's only
the .Type property that tells you what type of object it is.

But, here again, you already know what type of object it is, because
the only way to get the reference is through a parent container.
Indeed, the model there seems rather incoherent, as it has a .Parent
property, which doesn't exist in any object that can be accessed
through one of the AllXXXX collections.

But all of that is irrelevant, as MLH is programming in A97, which
lacks those new collections.

It just seems to me that it's not at all inconsistent with the way
all of Access works, and that the property itself, whether it
returns an object pointer or a string, is pretty much irrelevant,
since you can't use the property in any context that is not already
being accessed through the relevant container/collection.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 21 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some...
0
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
2
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
1
by: Brad H McCollum | last post by:
I'm writing an application using VB 6.0 as the front-end GUI, and the MSDE version of SQL Server as the back-end (it's a program for a really small # of users --- less then 3-4). I'm trying to...
10
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data...
3
by: Larry Serflaten | last post by:
I just put a simple exe out on the internet and tried to run it. All it does is manipulate its own images and respond to its own controls, but the darn thing needed FULL TRUST to run properly! ...
4
by: Joey | last post by:
Hey, How can I add/edit/delete Folder NTFS permissions in .NET? I have a Win2K Box, and WMI is not installed on my servers Thanks ahead! -- Joey
3
by: Alex Maghen | last post by:
Hi. I am really confused about the NTFS permissions that I must set for my ASP.NET 2.0 IIS application to work properly. I have looked at KB:815153 and that helps a *little* bit, but I need...
30
by: Adam Baker | last post by:
Hello, I'm writing a site where a handful of people will be able to edit the content using PHP scripts (FCKeditor). The content is stored as individual files in a directory. I'd like to validate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.