brunces
Registered User.
- Local time
- Today, 17:23
- Joined
- Sep 12, 2004
- Messages
- 45
Dear friends,
Please, I want to use AllowAdditions, AllowDeletions and AllowEdits for a form of mine, but I just don't
know how to create a VB code to do it.
Here's my case...
I have a form which is opened only before a password confirmation. I'm gonna call it "MainForm". And the
form I use to enter the username and his password, I'm gonna call it "LoginForm".
The LoginForm has:
- a combobox with a dropdown to choose a username;
- a textbox for the password input;
- a button (ENTER) which verifies the username/password confirmation and then opens the MainForm (if
password matches, offcourse! If not, there's a MsgBox for it.)
I've already done this! It's working pretty fine! The point is... Each username has a kind of "permission"
to handle the MainForm. For example:
There are only 5 users...
User1 - Can add, delete and edit.
User2 - Can add and delete.
User3 - Can add and edit.
User4 - Can delete and edit.
User5 - Can edit.
So, here's my doubt. When I click the button ENTER, in the LoginForm, besides checking username and
password, I want it to open the MainForm with those permissions allowed or not, depending on the user who
logged in.
How do I do that? I've seen something like this...
(... more code above)
If intUserID = 1 Then
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
Else
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
End With
End If
(... more code below)
But I confess, I didn't understand how to use it, how to design the code structure. In other words, I really
don't know how to create a VB code for that. Where would I put this code? Would it be part of the "OnClick
Event" for the button ENTER (LoginForm) or part of the "Sub Form_Open()" of the MainForm? Should I use
"Select Case" instead of "If...Then...Else" in the code? Whatever...
Please, if someone could help me, I would really appreciate it.
Thanks everyone for your attention.
Hugz.
Bruno
Obs.: For particular reasons, I don't use the Users/Group Security Accounts provided by MS Access.
Please, I want to use AllowAdditions, AllowDeletions and AllowEdits for a form of mine, but I just don't
know how to create a VB code to do it.
Here's my case...
I have a form which is opened only before a password confirmation. I'm gonna call it "MainForm". And the
form I use to enter the username and his password, I'm gonna call it "LoginForm".
The LoginForm has:
- a combobox with a dropdown to choose a username;
- a textbox for the password input;
- a button (ENTER) which verifies the username/password confirmation and then opens the MainForm (if
password matches, offcourse! If not, there's a MsgBox for it.)
I've already done this! It's working pretty fine! The point is... Each username has a kind of "permission"
to handle the MainForm. For example:
There are only 5 users...
User1 - Can add, delete and edit.
User2 - Can add and delete.
User3 - Can add and edit.
User4 - Can delete and edit.
User5 - Can edit.
So, here's my doubt. When I click the button ENTER, in the LoginForm, besides checking username and
password, I want it to open the MainForm with those permissions allowed or not, depending on the user who
logged in.
How do I do that? I've seen something like this...
(... more code above)
If intUserID = 1 Then
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
Else
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
End With
End If
(... more code below)
But I confess, I didn't understand how to use it, how to design the code structure. In other words, I really
don't know how to create a VB code for that. Where would I put this code? Would it be part of the "OnClick
Event" for the button ENTER (LoginForm) or part of the "Sub Form_Open()" of the MainForm? Should I use
"Select Case" instead of "If...Then...Else" in the code? Whatever...
Please, if someone could help me, I would really appreciate it.

Thanks everyone for your attention.
Hugz.
Bruno
Obs.: For particular reasons, I don't use the Users/Group Security Accounts provided by MS Access.