Private Sub GoLabel_Click()
On Error GoTo Err_GoLabel_Click
Dim UserType As String
Dim strSQL1 As String
Dim strSQL2 As String
txtPassword.SetFocus ' Set the Focus to Password to Workon
If txtPassword.Text <> "" Then
'NO Problem, Carry on
Else
MsgBox "Password Can not be Blank. please enter a valid value.", vbCritical, "Password Can not be Blank"
txtPassword.SetFocus ' Set the Focus to Password
Exit Sub
End If
'Get the UserType
UserType = Nz(DLookup("UserType", "tblUserManagement", "UserPassword ='" & txtPassword.Text & "'"), "")
If UserType = "MI" Then
Label59.Visible = False
Label53.Visible = False
Label52.Visible = False
Label58.Visible = True
Label58.Caption = "MI Reports"
With Label58
.Left = 5000
.Top = 2000
End With
myDynamicMainList.Visible = False
myStaticList.Visible = False
myStaticListOnFooter.Visible = True
With myStaticListOnFooter
.Left = 5000
.Top = 3000
End With
' myStaticListOnFooter.Visible = "Search DRS ID"
myStaticListOnFooter.RowSource = ""
myStaticListOnFooter.AddItem "MI-Daily DRS Request Report"
myStaticListOnFooter.AddItem "MI-All Documents under Transfers Category"
myStaticListOnFooter.AddItem "MI-Filter By Date Range"
myStaticListOnFooter.AddItem "MI-All Transfer docs filtered by requested destinations"
myStaticListOnFooter.AddItem "Search DRS ID"
myStaticListOnFooter.AddItem "Check Status of a DRS Request"
myStaticListOnFooter.AddItem "Report a problem"
myStaticListOnFooter.AddItem "Clear Database"
'Check if UserType matches the Required Users otherwise Prompt Error...
ElseIf UserType = "WL" Then
strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like '" & UserType & "*' order by ProcessID"
strSQL2 = "SELECT FormDisplayName " & _
" FROM tblStaticFormDB" & _
" WHERE FormDisplayName like '" & UserType & "*'"
'Adjust Visibility
Label59.Visible = False
myDynamicMainList.Visible = True
myStaticList.Visible = True
Label53.Visible = True
Label52.Visible = True
Label58.Visible = True
Label58.Caption = "Others"
myStaticListOnFooter.Visible = True
myStaticListOnFooter.RowSource = ""
' myStaticListOnFooter.AddItem "MI-Daily DRS Request Report"
' myStaticListOnFooter.AddItem "MI-Retained Documents Report"
myStaticListOnFooter.AddItem "Search DRS ID"
myStaticListOnFooter.AddItem "Check Status of a DRS Request"
myStaticListOnFooter.AddItem "DRS MI Reports"
myStaticListOnFooter.AddItem "Report a problem"
myStaticListOnFooter.AddItem "Clear Database"
With myStaticListOnFooter
.Top = 5508
.Left = 4251
End With
With Label58
.Top = 5200
.Left = 4251
End With
'Load the Lists
myDynamicMainList.RowSource = strSQL1
myStaticList.RowSource = strSQL2
'Do Nothing, Proceed to Operations
ElseIf UserType = "AXA" Then
strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like '" & UserType & "*' order by ProcessID"
strSQL2 = "SELECT FormDisplayName " & _
" FROM tblStaticFormDB" & _
" WHERE FormDisplayName like '" & UserType & "*'"
'Adjust Visibility
Label59.Visible = False
myDynamicMainList.Visible = True
myStaticList.Visible = True
Label53.Visible = True
Label52.Visible = True
Label58.Visible = True
Label58.Caption = "Others"
myStaticListOnFooter.Visible = True
myStaticListOnFooter.RowSource = ""
' myStaticListOnFooter.AddItem "MI-Daily DRS Request Report"
' myStaticListOnFooter.AddItem "MI-Retained Documents Report"
myStaticListOnFooter.AddItem "Find DRS ID"
myStaticListOnFooter.AddItem "Check Status of a DRS Request"
myStaticListOnFooter.AddItem "DRS MI Reports"
myStaticListOnFooter.AddItem "Report a problem"
myStaticListOnFooter.AddItem "Clear Database"
With myStaticListOnFooter
.Top = 5508
.Left = 4251
End With
With Label58
.Top = 5200
.Left = 4251
End With
'Load the Lists
myDynamicMainList.RowSource = strSQL1
myStaticList.RowSource = strSQL2
ElseIf UserType = "EL" Then
strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like '" & UserType & "*' order by ProcessID desc"
strSQL2 = "SELECT FormDisplayName " & _
" FROM tblElevateStatic" & _
" WHERE FormDisplayName like '" & UserType & "*'"
'Adjust Visibility
Label59.Visible = False
myDynamicMainList.Visible = True
myStaticList.Visible = True
myStaticListOnFooter.Visible = True
myStaticListOnFooter.RowSource = ""
myStaticListOnFooter.AddItem "Search DRS ID"
myStaticListOnFooter.AddItem "Check Status of a DRS Request"
Label53.Visible = True
Label52.Visible = True
Label58.Visible = True
Label58.Caption = "Others"
'Load the Lists
With myStaticListOnFooter
.Top = 5508
.Left = 4251
End With
With Label58
.Top = 5200
.Left = 4251
End With
'Load the Lists
myDynamicMainList.RowSource = strSQL1
myStaticList.RowSource = strSQL2
ElseIf UserType = "ALL1" Then
UserType = "*"
' strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like '" & u1 & "*' or ProcessSpecificFormName like '" & u1 & "*' order by ProcessID"
strSQL2 = "SELECT FormDisplayName " & _
" FROM tblElevateStatic" & _
" WHERE FormDisplayName like '" & UserType & "*'"
UserType = "EL -"
strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like '" & UserType & "*' or ProcessSpecificFormName like 'WL *' order by ProcessID"
'Adjust Visibility
Label59.Visible = False
Label53.Visible = True
Label52.Visible = True
' Label58.Visible = True
myDynamicMainList.Visible = True
myStaticList.Visible = True
myStaticListOnFooter.Visible = False
Label58.Visible = False
'Load the Lists
myDynamicMainList.RowSource = strSQL1
myStaticList.RowSource = strSQL2
ElseIf UserType = "ALL" Then
UserType = "*" 'Change UserType= All to SQL readable '*'
strSQL1 = "SELECT ProcessSpecificFormName " & _
" FROM tblProcess" & _
" WHERE ProcessSpecificFormName like 'AXA *' or ProcessSpecificFormName like 'WL *' order by ProcessID"
strSQL2 = "SELECT FormDisplayName " & _
" FROM tblStaticFormDB" & _
" WHERE FormDisplayName like '" & UserType & "*'"
'Adjust Visibility
Label59.Visible = False
myDynamicMainList.Visible = True
myStaticList.Visible = True
Label58.Visible = True
Label58.Caption = "Others"
Label53.Visible = True
Label52.Visible = True
myStaticListOnFooter.Visible = True
myStaticListOnFooter.RowSource = ""
myStaticListOnFooter.AddItem "MI-Daily DRS Request Report"
myStaticListOnFooter.AddItem "Find DRS ID"
myStaticListOnFooter.AddItem "Check Status of a DRS Request"
myStaticListOnFooter.AddItem "DRS MI Reports"
myStaticListOnFooter.AddItem "Report a problem"
myStaticListOnFooter.AddItem "Clear Database"
With myStaticListOnFooter
.Top = 5508
.Left = 4251
End With
With Label58
.Top = 5200
.Left = 4251
End With
'Load the Lists
myDynamicMainList.RowSource = strSQL1
myStaticList.RowSource = strSQL2
Else
MsgBox "User Password is wrong. Please enter a valid password.", vbCritical, "Wrong password"
txtPassword.SetFocus ' Set the Focus Back to Password
Exit Sub
End If
'Queries to Get the FormNames [in the Lists]
Exit_Err_GoLabel_Click:
Exit Sub
Err_GoLabel_Click:
MsgBox "Error in loading Dynamic Forms, " & Err.Description & ". contact WL Development Team."
Resume Exit_Err_GoLabel_Click
End Sub
[
I]Your post does not comply with Rule 3 of our Forum [/I]RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks