|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: |
Private Sub cmdUpdateContact_Click()
Dim strDayName As String
Dim strUserName As String
Dim intRandomNumber As String
Dim strFName As String
Dim strsql As String
Dim dateExists As Integer
Dim dateExists4wks As Integer
Dim dtStart As Date
Dim dtEnd As Date
Dim dt4Weeks As Date
'Here we'll set up some task for the contact update
'Next we'll process the check winning process
strDayName = Format(Date, "dddd")
strUserName = fOSUserName()
strFName = DLookup("UserFirstName", "tblHSGUsers_ResOps", " [UserNetworkName] = '" & fOSUserName() & "'")
intRandomNumber = Int((Round(((1 * Nz(DCount("User_ID", "tblHSGUsers_ResOps"))) * 5) * 2.5, 0) - 1 + 1) * Rnd() + 1)
dtStart = Format(Date, "mm/dd/yyyy")
Select Case Weekday(dtStart)
Case "2"
dtEnd = Format(Date, "mm/dd/yyyy")
Case "3"
dtEnd = Format(DateDiff("d", 1, Date), "mm/dd/yyyy")
Case "4"
dtEnd = Format(DateDiff("d", 2, Date), "mm/dd/yyyy")
Case "5"
dtEnd = Format(DateDiff("d", 3, Date), "mm/dd/yyyy")
Case "6"
dtEnd = Format(DateDiff("d", 4, Date), "mm/dd/yyyy")
End Select
dt4Weeks = Format(DateDiff("d", 28, Date), "mm/dd/yyyy")
dateExists = DCount("Winner_Date", "tblWinners_ResOps", "[Winner_Date] BETWEEN #" & dtStart & "# AND #" & dtEnd & "#")
dateExists4wks = DCount("Winner_Name", "tblWinners_ResOps", "Winner_Name = " & strUserName & "" And "[Winner_Date] BETWEEN #" & dtStart & "# AND #" & dt4Weeks & "#")
'check if it is ResOps Managers
If LCase(strUserName) <> "Manager1" Or LCase(strUserName) <> "Manager2" Then
'Check if it is the first 3 days of the week
If strDayName = "Monday" Or strDayName = "Tuesday" Or strDayName = "Wednesday" Then
'Check if there is a winner this date
If dateExists = 0 Then
' THIS SECTION IS NOT WORKING CORRECTLY AND NEED TO FIGURE OUT WHY
'Check if date exists 4 weeks ago
If dateExists4wks = 0 Then
'Check if random # generated is equal to 17
If intRandomNumber = 17 Then
MsgBox strFName & " You WON!!!"
strsql = "INSERT INTO tblWinners_ResOps ( Winner_Name, Winner_Date ) " & _
"SELECT fOSUserName() AS Winner_Name, Date() AS Winner_Date;"
Debug.Print
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings True
End If
End If
End If
End If
End If
End Sub
'Using this function to get the UserName
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
'-----------------------------------------------------------------------------------------
' This code is used to retrieve the network user name by accessing the API apiGetUserName.
' Created by: Unknown (Found on Dev Ashish web site http://home.att.net/~dashish/api)
'-----------------------------------------------------------------------------------------
Public Function fOSUserName() As String
On Error GoTo fOSUserName_Err
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
fOSUserName_Exit:
Exit Function
fOSUserName_Err:
MsgBox Error$
Resume fOSUserName_Exit
End Function
|
Advertisement
| Hall of Fame |