Hi
I was wondering if anyone might be able to help me. I was trying to calculate for the gross payment by adding up the sum of net_pay and the sum of tax_pay.
I've got the following error message
runtime error '-2147217900 (80040e14)'
Syntax error in FROM clause
when trying to run the following code
'Set row source for list box
StrSQL = "SELECT Salary.Staff_ID, Salary.Tax_Amount, Salary.Net_Amount, Salary.Date1 "
StrSQL = StrSQL & "FROM Salary "
StrSQL = StrSQL & "WHERE Salary.Staff_ID like '" & Me.CB_StaffID & "' AND Salary.Date1 Between #1/1/2005# And #1/1/2006# ORDER BY Salary.Date1"
rsNew.Open StrSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do Until rsNew.EOF
mytot_taxpay = mytot_taxpay + rsNew!Tax_Amount
mytot_netpay = mytot_netpay + rsNew!Net_Amount
Loop
Me.TB_GrossSalary = mytot_taxpay + mytot_netpay ' total gross pay for the staff
rsNew.Close
Any ideas?
Thank you for your help in advance
I was wondering if anyone might be able to help me. I was trying to calculate for the gross payment by adding up the sum of net_pay and the sum of tax_pay.
I've got the following error message
runtime error '-2147217900 (80040e14)'
Syntax error in FROM clause
when trying to run the following code
'Set row source for list box
StrSQL = "SELECT Salary.Staff_ID, Salary.Tax_Amount, Salary.Net_Amount, Salary.Date1 "
StrSQL = StrSQL & "FROM Salary "
StrSQL = StrSQL & "WHERE Salary.Staff_ID like '" & Me.CB_StaffID & "' AND Salary.Date1 Between #1/1/2005# And #1/1/2006# ORDER BY Salary.Date1"
rsNew.Open StrSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do Until rsNew.EOF
mytot_taxpay = mytot_taxpay + rsNew!Tax_Amount
mytot_netpay = mytot_netpay + rsNew!Net_Amount
Loop
Me.TB_GrossSalary = mytot_taxpay + mytot_netpay ' total gross pay for the staff
rsNew.Close
Any ideas?
Thank you for your help in advance