Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Load Event and Msg Box

Status
Not open for further replies.

haj1503

Technical User
May 29, 2001
56
0
0
MY
Hi Friends....,

I've wrote code in my On Load event procedure something like this :
If gintIsAccessLevel = 1 Or 2 = glngCurrentPersonalID Then
DoCmd.OpenForm "frmDeliveryOrderOptions"
Else
If gintIsAccessLevel = 5 = glngCurrentPersonalID Then
MsgBox "Sorry you are visitor only, you don't have any permission for viewing all records.", vbCritical, "Materials Planning & Purchasing Management System"
Exit Sub
DoCmd.Close
End If
End If
but what i need from my event is i need "frmDeliveryOrderOptions" Open when AccessLevel = 1 or 2 but Close form when AccessLevel = 5 and then if Access Level = 5, Msg will appear like above. please tell me if i wrong and teach me how suppose i wrote in my event Procedure.

Your advance assistance must be appreciated.
Best Regards,

Haj1503
 
why use the OnLoad Event? If you are opening this from another Form, then attach it to the command button you use to open the New Form "frmDeliveryOrderOptions"

Private Sub cmdOpenForm_Click()
Select Case gintIsAccessLevel
Case 1,2
DoCmd.OpenForm ("frmDeliveryOrderOptions")
Case 5
MsgBox "Sorry you are visitor only, you don't have any permission for viewing all records.", vbCritical, "Materials Planning & Purchasing Management System"
Case Else
'Do something else or nothing at all
End Select
End Sub

Or if the FfrmDeliveryOrderOptions is the first Form to appear, you can add a Function and call that Function from an AutoExec Macro

PaulF
 
Hi PaulF,

Actually form "frmDeliveryOrderOptions" is using for options to open another form "frmDeliveryOrder". i also have switchboardform wizard where in my switchboard form have button when i click "Delivery Order" "frmDeliveryOrderOptions" will appear but what i am need from here if LevelAccess = with 1 or 2 then this "frmDeliveryOrderOptions" will appear but if LevelAccess = with 5 and then Msg will appear and this form not appear.

I hope you understand with my explanation.

Thanks for Advance Asisstance.

Haj1503
 
what you need to do is create a Function in a Module that is called from the Switchboard (use Run Code Option), instead of just having the Switchboard open frmDeliveryOrderOptions.

Function CheckID()
Select Case gintIsAccessLevel
Case 1,2
DoCmd.OpenForm ("frmDeliveryOrderOptions")
Case 5
MsgBox "Sorry you are visitor only, you don't have any permission for
viewing all records.", vbCritical, "Materials Planning & Purchasing Management System"
Case Else
'Do something else or nothing at all
End Select
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top