I am getting a compile error on this line in my code below... I am trying to assign approval levels depending on currentuser who is loged or signed into database.
<< If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") < ApprovalAmount(CurrentUser) Then>> Highlighting "Approvalamount " saying that the Argument is not optional.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") = 0 Then
MsgBox "Forecast Must Be Entered"
Else
'If strManagerType = "EVP" Then
If CurrentUser = "EVP" Then
MsgBox "Approved"
Else
If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") < ApprovalAmount(CurrentUser) Then
MsgBox "Approved"
Else
MsgBox "Amounts Cannot Be Approve
Function ApprovalAmount(strManagerType As String, TotalCost As Long) As Boolean
Dim ApprovalLimit As Long
Dim rst As New ADODB.Recordset
''Set rst = CurrentProject.Connection.Execute("SELECT tblUsers.UserID " & _
"FROM tblusers " & _
'"WHERE (tblUsers.UserID)='" & [CurrentUser] & "'")
Select Case currentuser
Case "SM"
ApprovalLimit = 300000
Case "DIR"
ApprovalLimit = 1500000
Case "VP1"
ApprovalLimit = 3000000
Case "EVP"
CanApprove = True
Exit Function
End Select
CanApprove = (TotalCost < ApprovalLimit)
End Function
<< If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") < ApprovalAmount(CurrentUser) Then>> Highlighting "Approvalamount " saying that the Argument is not optional.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") = 0 Then
MsgBox "Forecast Must Be Entered"
Else
'If strManagerType = "EVP" Then
If CurrentUser = "EVP" Then
MsgBox "Approved"
Else
If Val(Me.ProjectedTotal & "") + Val(Me.ProjectedTotal & "") < ApprovalAmount(CurrentUser) Then
MsgBox "Approved"
Else
MsgBox "Amounts Cannot Be Approve
Function ApprovalAmount(strManagerType As String, TotalCost As Long) As Boolean
Dim ApprovalLimit As Long
Dim rst As New ADODB.Recordset
''Set rst = CurrentProject.Connection.Execute("SELECT tblUsers.UserID " & _
"FROM tblusers " & _
'"WHERE (tblUsers.UserID)='" & [CurrentUser] & "'")
Select Case currentuser
Case "SM"
ApprovalLimit = 300000
Case "DIR"
ApprovalLimit = 1500000
Case "VP1"
ApprovalLimit = 3000000
Case "EVP"
CanApprove = True
Exit Function
End Select
CanApprove = (TotalCost < ApprovalLimit)
End Function