BvCF
MIS
- Nov 11, 2006
- 92
What is the preferred method to maximize a form - On Click Event?
Currently, when the end user enters their username and password, the form is very small and should be maximized.
The line "DoCmd.RunCommand acCmdAppMaximize" doesn't appear to work.
Displayed below is the code.
Private Sub cmdLogin_Click()
'************************ login sequence
'On Error GoTo local_err
DoCmd.RunCommand acCmdSaveRecord
'
GBL_Access_Level = "X"
GBL_Access_Level = Nz(DLookup("Access_Level", "L_Employees", "Username='" & Nz(Me.UserName, " ") & "' and password='" & Nz(Me.Password, " ") & "'"), "X")
'
If GBL_Access_Level = "X" Then
MsgBox "Invalid Username or Password... try again."
Exit Sub
End If
'
GBL_Employee_ID = Nz(DLookup("Employee_ID", "Employees", "Username='" & Nz(Me.UserName, " ") & "' and password='" & Nz(Me.Password, " ") & "'"), "X")
'
Me.TabCtl0.Pages.Item(0).Caption = "Welcome " & Nz(DLookup("Username", "Employees", "Employee_ID=" & get_global("Employee_ID")), "Invalid Login")
'frmTabbed.Requery 'commented out
'
' call subroutine to set access to forms
'
Call set_privs
'
Forms!frmTabbed.Requery
Me.UserName = ""
Me.Password = ""
Me.TabCtl0.Pages.Item(2).SetFocus
DoCmd.RunCommand acCmdAppMaximize ' Just Added
Exit Sub
End Sub
Currently, when the end user enters their username and password, the form is very small and should be maximized.
The line "DoCmd.RunCommand acCmdAppMaximize" doesn't appear to work.
Displayed below is the code.
Private Sub cmdLogin_Click()
'************************ login sequence
'On Error GoTo local_err
DoCmd.RunCommand acCmdSaveRecord
'
GBL_Access_Level = "X"
GBL_Access_Level = Nz(DLookup("Access_Level", "L_Employees", "Username='" & Nz(Me.UserName, " ") & "' and password='" & Nz(Me.Password, " ") & "'"), "X")
'
If GBL_Access_Level = "X" Then
MsgBox "Invalid Username or Password... try again."
Exit Sub
End If
'
GBL_Employee_ID = Nz(DLookup("Employee_ID", "Employees", "Username='" & Nz(Me.UserName, " ") & "' and password='" & Nz(Me.Password, " ") & "'"), "X")
'
Me.TabCtl0.Pages.Item(0).Caption = "Welcome " & Nz(DLookup("Username", "Employees", "Employee_ID=" & get_global("Employee_ID")), "Invalid Login")
'frmTabbed.Requery 'commented out
'
' call subroutine to set access to forms
'
Call set_privs
'
Forms!frmTabbed.Requery
Me.UserName = ""
Me.Password = ""
Me.TabCtl0.Pages.Item(2).SetFocus
DoCmd.RunCommand acCmdAppMaximize ' Just Added
Exit Sub
End Sub