I am getting an error using the group level security Public Function when using the On Open, On Current or On Load properties of the form. Error not happening if using the On Click of a button. Attached screen shots.
Looks like it's not picking up a UserID
UserID=ANDGroupID=1
Kevin Robertson 3 years ago
That error is telling you there is no value in Forms!MainMenuF!txtUserID. It looks like, from your second image, that you are trying to get the value before the Main Menu is loaded.
Scott Axton 3 years ago
In addition to what the other guys said above, pay attention to spaces. They matter in this case. It looks like you need a space before AND.
The best way to troubleshoot the formula is to message box it sometimes to make sure it is working properly.
Temporarily put in this right after X=......
MsgBox X
Exit Sub
Scott Axton 3 years ago
Make sure you are using the correct form.
I see that you are using the LoginF when you get the error. The code in the 3rd picture is trying to refer to Forms!mainmenuf!txtUserID
I'm assuming here but I don't think you would have that value set yet on your mainmenuf yet if you are logging in.
A clue for me is that you don't have the CamelCase in your form name either. Check spelling.
Scott Axton 3 years ago
Kevin Sorry I just saw your response. Had the pics open in another screen when I replied and missed yours.
Kevin Robertson 3 years ago
LOL Scott I do that often.
Pino ArcuriOP 3 years ago
Pino ArcuriOP 3 years ago
Pino ArcuriOP 3 years ago
Pino ArcuriOP 3 years ago
Pino ArcuriOP 3 years ago
Thank you all,
Fixed the CamelCase and space before AND. Same error.
Deleting the On Current Event of the MainMenuF allows it move on from the LoginF and the UserID shows on the MainMenuF.
Assigning the same code to an On Click button in the MainMenuF works.
"If IsUserInGroup(1) Then
Me.FormulationSelectionCombo.Visible = False
Else
Me.FormulationSelectionCombo.Visible = True
End If
End Sub
Adam Schwanz 3 years ago
Just to confirm what is the code behind the login button? Could you also share screenshot of the 3 tables? Users groups userxgroups. Are any of the number fields short text? Just a few ideas we might find an error in
Pino ArcuriOP 3 years ago
Sorry, images attached above, I should have explained, I still want the On Current to work, assigning the code to a Command Button was only a means to test the Public code once in the MainMenuF.
Kind Regards
Pino
Adam Schwanz 3 years ago
On the login form you are referring to the main menu before its even set or open. Change the forms!mainmenu stuff to the name of that combobox on your loginf
Pino ArcuriOP 3 years ago
Thank you Adam,
You got it regarding the reference to the MainMenuF before being open.
Created a txtUserID on the LoginF form and changed the code to the attached. All working as should as long as the LoginF is open, I can work around that. However, any suggestions to the IsUserInGroup code to have it referencing off the MainMenuF and close the LoginF?
Thank you for your help.
Regards
Pino
Pino ArcuriOP 3 years ago
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Security Seminar Lessons.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.