ADO CREATE USER question

T

Tony_VBACoder

In Access 2002, I am trying to create a new user "Homer
Simpson" (I want a space between First and Last Name) with
no password and a PID of "hsimpson". What is the syntax
for this when the first parameter of the CREATE USER
statement has a space in it, 2nd parameter is empty and
3rd parameter is PID? I have tried the following but am
confused on how Access will interpret the parameters. I
can create the user successfully if I use the
Tools/Security/User and Group Accounts method. However,
if I run the code below, a user of Homer gets created,
with Simpson set as the password and hsimpson as the PID:

********************************************************
Dim conDatabase As ADODB.Connection
Set conDatabase = Application.CurrentProject.Connection
conDatabase.Execute "CREATE USER Homer Simpson hsimpson"
********************************************************

I have tried the ADO method below with success, however, I
can't find any place where I can set the PID:

Dim cat As ADOX.Catalog
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
cat.Users.Append "Homer Simpson",""
 
J

Joan Wild

Is there a reason you are using ADO? I always use DAO to do this - look up
the CreateUser method in help - there's a full example. It's my
understanding that ADOX is incomplete and buggy - just plain doesn't work
for some things.
 
T

Tony_VBACoder

With all this talk about DAO going away, I am trying my
hand at coding in ADO.

If anyone has an answer to why I can't get this work with
ADO, I'd love to hear it. In the meantime, I will look
into the DAO method as I know that has worked in the past.
 
J

Joan Wild

Tony_VBACoder said:
With all this talk about DAO going away, I am trying my
hand at coding in ADO.

If anyone has an answer to why I can't get this work with
ADO, I'd love to hear it. In the meantime, I will look
into the DAO method as I know that has worked in the past.

I hate to break it to you, but ADO is deader than DAO (it's being taken over
by ADO.NET - not at all a similar beast). If you are going against Jet,
then use DAO.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Create a New User PID with Code 2
List All Users DAO/ADO issue 1
ACC 2002 - sql ADD USER TO error 2
get column name by ADOX 2
VBA HELP 1
update table records from form 6
Syntax error? 2
error with my ADO code! 2

Top