473,322 Members | 1,409 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,322 software developers and data experts.

I was planning to use this code to add users in A97...

MLH
I have not yet tried running this code in Access 97. It was
ported from Access 2.0. It fails to compile, failing on the line
xxxxxxxxxxxxxxxxxxx

Function MakeUsersFromTable(TableName As String, GroupName As String)
'************************************************* ********************
' Accepts TableName, GroupName
'
' Returns "Users Added" if successful. Otherwise, "Users Not Added".
'
' The object here is to have a table with three fields feed a data
' stream to this procedure. The three fields represent user name,
' personal id (PID) and password. The procedure churns out a new user
' for each record in the table.
'************************************************* ********************
On Error GoTo Err291

Dim MyWorkSpace As Workspace, MyDatabase As Database
Dim MyRecordSet As Recordset, MyUser As USER, MyGroup As Group
Set MyWorkSpace = DBEngine.Workspaces(0)
Set MyDatabase = DBEngine.Workspaces(0).Databases(0)
Set MyRecordSet = MyDatabase.OpenRecordset(TableName, DB_OPEN_DYNASET)
MyRecordSet.MoveFirst

Do Until MyRecordSet.EOF
Set MyUser = MyWorkSpace.CreateUser(MyRecordSet!UserName,
MyRecordSet!PID, MyRecordSet!Password) ' name, PID and ZLS password
MyWorkSpace.Users.Append MyUser
Set MyUser = MyWorkSpace.CreateUser(MyRecordSet![UserName]) ' not
knowing this line needed 2B here cost me an entire day!
MyWorkSpace.Groups(GroupName).Users.Append MyUser
MyRecordSet.MoveNext
LoopMark:
Loop
MakeUsersFromTable = "Users Added"

Exit291:
Exit Function

Err291:
If Err = 3390 Then
MsgBox MyRecordSet.UserName & " is already a user! Make a note of
it.", 64, "User Exists!" & " - " & MyApp$ & ", rev. " & MY_VERSION$
GoTo LoopMark ' could put Resume Next in here
End If
MakeUsersFromTable = "Users Not Added"
MsgBox Error$ & Err, 16, MyApp & ", version " & MY_VERSION$
GoTo Exit291

End Function
It fails saying "Method or data member not found when compiling
MsgBox MyRecordSet.UserName (under Err291: label).
Is this easily fixed?
Nov 13 '05 #1
2 1296
MLH
Big oops!

I changed the following line...

MsgBox MyRecordSet.UserName & " is already a user! Make a note of
it.", 64, "User Exists!" & " - " & MyApp$ & ", rev. " & MY_VERSION$

to

MsgBox MyRecordSet!UserName & " is already a user! Make a note of
it.", 64, "User Exists!" & " - " & MyApp$ & ", rev. " & MY_VERSION$

and now it compiles fine. Just a small syntax error. Replacing period
with bang did the trick. I'm assuming the code will run. Do any of you
recommend a better alternative coding strategy?
Nov 13 '05 #2
MLH <CR**@NorthState.net> wrote in
news:r0********************************@4ax.com:
Big oops!

I changed the following line...

MsgBox MyRecordSet.UserName & " is already a user! Make a note of
it.", 64, "User Exists!" & " - " & MyApp$ & ", rev. " &
MY_VERSION$

to

MsgBox MyRecordSet!UserName & " is already a user! Make a note of
it.", 64, "User Exists!" & " - " & MyApp$ & ", rev. " &
MY_VERSION$

and now it compiles fine. Just a small syntax error. Replacing
period with bang did the trick. I'm assuming the code will run. Do
any of you recommend a better alternative coding strategy?


Well, you have to understand that in recordsets, . denotes a
property, and ! denotes a member of the default collection
(Fields()).

The promiscuous intermingling of . and ! is something that is
encouraged by the implicit function wrappers around controls in
forms/reports, and I think is a bad practice, precisely because it
leads to problems like this when you try to transfer the practice
outside its domain of applicability.

Of course, Access 2 was much worse about that, if I remember
correctly.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3

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

Similar topics

1
by: Logu | last post by:
Hi Any Ideas and Inputs on Cost Estimation/Planning stage of .NET Projects, i.e. things like Function point Analysis, COCOMO and on full planning stages etc etc. Any Frameworks, feasible...
2
by: Koen | last post by:
Hi all, Is there any example code available somewhere that graphical visualizes a simple network planning (PERT chart)? I have two tables: tblAction: ActionID (PK) Description
3
by: MLH | last post by:
I need a financial planning application. I don't want to write it if a suitable app has already been written and exists in the public domain. All that such an app would need to be designed to do...
1
by: jc | last post by:
I must create an application with Access 2003 which generate a fabrication planning i don't know how i can sort cells because i have different parameter has to take into account. do you know...
0
by: Yoxel.Com | last post by:
Release Planning System" at Yoxel.Com allows software development teams to: - collaboratively create a release plan based on deadline, effort estimates and priorities. - track implementation...
1
by: Hugh Janus | last post by:
Hi all, I have the following problem on a project I am working on. Right now, I am in the planning stage, which is where I want the help. I have to calculate a route between two different...
1
by: PP | last post by:
Hello Based on three tables (Projects, Tasks and UserCalender) I would like to work out the total amount of available resources (UserCalender table contains a entry for each user for each day,...
2
by: Logu Krishnan | last post by:
Hi, I'm looking out info on how to perform System Sizing and Capacity Planning for a product built using ASP.NET... is there any specifics ? any pointers to these will be highly appreciated. ...
0
by: Joseph Ferris | last post by:
Good afternoon, I understand the basic theories of capacity planning as it relates to profiling an existing web site, such as in the examples given in the MSDN Article, "How To: Perform Capacity...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.