brunces
Registered User.
- Local time
- Today, 07:56
- Joined
- Sep 12, 2004
- Messages
- 45
Friends,
Please, I really need some help, here because I don't understand what's happening.![Frown :( :(](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I have a form which is opened based on these parameters, after a user logs in:
**** Code *****
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Select Case IntCodePerm
Case 0
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Case 1
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = True
Case 2
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = False
Case 3
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Case 4
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
Case 5
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = True
Case 6
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = False
Case Else
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
End Select
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Form_Open
End Sub
***** End Code *****
"IntCodePerm" is a public variable (integer) declared in a module which receives the "code of permission" of the user who logged in. (There's a table for users with their respective codes.)
These are the codes of permission a user can have.
Level Code - Permission Description
0 - Can add, edit and delete.
1 - Can add and edit.
2 - Can add and delete.
3 - Can edit and delete.
4 - Can add.
5 - Can edit.
6 - Can delete.
7 - Can't do anything, just consult (search).
This form is based on a table. There are no combos in it, just single fields. I created my own navigation buttons; so they are:
Buttons:
- ButRecFirst
- ButRecPrevious
- ButRecNext
- ButRecLast
- ButRecNew (Add)
- ButRecDelete (Delete)
The VB code for the "ButRecDelete" is this one:
***** Code *****
Private Sub ButRecDelete_Click()
On Error GoTo Err_ButRecDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_ButRecDelete_Click:
Exit Sub
Err_ButRecDelete_Click:
MsgBox Err.Description
Resume Exit_ButRecDelete_Click
End Sub
***** End Code *****
I didn't create this code, Access did it by itself, as default.
And here are the problems I have:
1) I realized that even if "AllowAdditions" is False, if I click to go to the last record and then I click on "ButRecNext" button, it shows me a "blank record" and allows me to "add a new record", using this "blank one". This CANNOT happen! When the last record is being shown, the "next record button" cannot be enabled, or then it cannot show a blank record in which I can add something (as a new record).
2) I also realized that in all cases when "AllowEdits" is False and "AllowDeletions" is True, the button "ButRecDelete" DOESN'T work. This CANNOT happen either! That doesn't make any sense. If "AllowDeletions" is True, the button "ButRecDelete" has to work, independing on "AllowEdits" condition.
Note: When "AllowAdditions" and/or "AllowsEdits" are both True, everything works fine! So, I guess there's nothing wrong with the code or the variable. (Is there?)
Sorry, I know I wrote many things here, but it was just to expose my problem in a better way.
Please, if someone knows how to solve these 2 problems and wants to help me, I really appreciate it.
Thank you all for your attention, guys.![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Hugz.
Bruno
Please, I really need some help, here because I don't understand what's happening.
I have a form which is opened based on these parameters, after a user logs in:
**** Code *****
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Select Case IntCodePerm
Case 0
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Case 1
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = True
Case 2
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = False
Case 3
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Case 4
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
Case 5
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = True
Case 6
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = False
Case Else
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
End Select
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Form_Open
End Sub
***** End Code *****
"IntCodePerm" is a public variable (integer) declared in a module which receives the "code of permission" of the user who logged in. (There's a table for users with their respective codes.)
These are the codes of permission a user can have.
Level Code - Permission Description
0 - Can add, edit and delete.
1 - Can add and edit.
2 - Can add and delete.
3 - Can edit and delete.
4 - Can add.
5 - Can edit.
6 - Can delete.
7 - Can't do anything, just consult (search).
This form is based on a table. There are no combos in it, just single fields. I created my own navigation buttons; so they are:
Buttons:
- ButRecFirst
- ButRecPrevious
- ButRecNext
- ButRecLast
- ButRecNew (Add)
- ButRecDelete (Delete)
The VB code for the "ButRecDelete" is this one:
***** Code *****
Private Sub ButRecDelete_Click()
On Error GoTo Err_ButRecDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_ButRecDelete_Click:
Exit Sub
Err_ButRecDelete_Click:
MsgBox Err.Description
Resume Exit_ButRecDelete_Click
End Sub
***** End Code *****
I didn't create this code, Access did it by itself, as default.
And here are the problems I have:
1) I realized that even if "AllowAdditions" is False, if I click to go to the last record and then I click on "ButRecNext" button, it shows me a "blank record" and allows me to "add a new record", using this "blank one". This CANNOT happen! When the last record is being shown, the "next record button" cannot be enabled, or then it cannot show a blank record in which I can add something (as a new record).
2) I also realized that in all cases when "AllowEdits" is False and "AllowDeletions" is True, the button "ButRecDelete" DOESN'T work. This CANNOT happen either! That doesn't make any sense. If "AllowDeletions" is True, the button "ButRecDelete" has to work, independing on "AllowEdits" condition.
Note: When "AllowAdditions" and/or "AllowsEdits" are both True, everything works fine! So, I guess there's nothing wrong with the code or the variable. (Is there?)
Sorry, I know I wrote many things here, but it was just to expose my problem in a better way.
Please, if someone knows how to solve these 2 problems and wants to help me, I really appreciate it.
Thank you all for your attention, guys.
Hugz.
Bruno