I need the help of one of you regarding this function.
I am creating a form to pull value from employees for each month of the year and I want to create a function to pull those values from a table. the function is giving me a mismatch error and I can not figure out.
Thanks in advance.
Option Compare Database
Option Explicit
Public Function MonthlyAmt(FLNo As Integer) As Currency
Dim MthDate As Date
Dim MonthNO As Integer
Dim YearNo As Integer
Dim MatchAMT As Currency
Dim STCreteria As String
Dim FMTest As Form
Dim TAGValue As Integer
'Dim flno As Integer
Set FMTest = Forms!FROnScreenTest
TAGValue = FMTest.Tag
TAGValue = Int(TAGValue)
Debug.Print TAGValue
'STCreteria = " Month(MatchMonth) =" & MonthNO & " AND EmployeeID=" & FLNo
MthDate = DLookup("matchmonth", "TBMatchAmount")
MatchAMT = DLookup("matchamount", "tbmatchamount")
MonthNO = Month(MthDate)
YearNo = Year(MthDate)
' MonthlyAmt = DLookup("matchamount", "tbmatchamount", " month(matchmonth) =" & TAGValue & "" And " EmployeeID=" & FLNo & "")
Debug.Print MonthlyAmt
End Function
I am creating a form to pull value from employees for each month of the year and I want to create a function to pull those values from a table. the function is giving me a mismatch error and I can not figure out.
Thanks in advance.
Option Compare Database
Option Explicit
Public Function MonthlyAmt(FLNo As Integer) As Currency
Dim MthDate As Date
Dim MonthNO As Integer
Dim YearNo As Integer
Dim MatchAMT As Currency
Dim STCreteria As String
Dim FMTest As Form
Dim TAGValue As Integer
'Dim flno As Integer
Set FMTest = Forms!FROnScreenTest
TAGValue = FMTest.Tag
TAGValue = Int(TAGValue)
Debug.Print TAGValue
'STCreteria = " Month(MatchMonth) =" & MonthNO & " AND EmployeeID=" & FLNo
MthDate = DLookup("matchmonth", "TBMatchAmount")
MatchAMT = DLookup("matchamount", "tbmatchamount")
MonthNO = Month(MthDate)
YearNo = Year(MthDate)
' MonthlyAmt = DLookup("matchamount", "tbmatchamount", " month(matchmonth) =" & TAGValue & "" And " EmployeeID=" & FLNo & "")
Debug.Print MonthlyAmt
End Function