I'm just upgrading our local database to access 2000 and MSDE. The problem I'm having, is that views don't seem to be all they're made out to be.
I had this query in access that calculated an amount due, based on the amount of hours a person has worked. There are three different rates; first hour, second hour, all other hours over 2 hours.
Using queries in Access I was able to call a function I had coded in a module to perform a SELECT CASE on the amount of hours worked and return the amount due to my query.
using views, I cannot do this. I cannot use compound statements (IF ELSE or CASE .. WHEN).
does anyone know how to get around this? I know I can sit the whole thing into a stored procedure, but then I need to use VBA and ADO to process the output.
although it's not really necessary here's the old query and VBA that did the job.
Query
------
SELECT jobID, getPayRate([hours]) AS amountDue FROM JobCard
VBA
---------
public Function getPayRate(iHours as integer) as currency
SELECT CASE iHours
CASE 1
getPayRate = 65
CASE 2
getPayRate = 100
CASE ELSE
getPayRate = 100 + ((iHours - 2) * 25)
END SELECT
end Function
---------
I had this query in access that calculated an amount due, based on the amount of hours a person has worked. There are three different rates; first hour, second hour, all other hours over 2 hours.
Using queries in Access I was able to call a function I had coded in a module to perform a SELECT CASE on the amount of hours worked and return the amount due to my query.
using views, I cannot do this. I cannot use compound statements (IF ELSE or CASE .. WHEN).
does anyone know how to get around this? I know I can sit the whole thing into a stored procedure, but then I need to use VBA and ADO to process the output.
although it's not really necessary here's the old query and VBA that did the job.
Query
------
SELECT jobID, getPayRate([hours]) AS amountDue FROM JobCard
VBA
---------
public Function getPayRate(iHours as integer) as currency
SELECT CASE iHours
CASE 1
getPayRate = 65
CASE 2
getPayRate = 100
CASE ELSE
getPayRate = 100 + ((iHours - 2) * 25)
END SELECT
end Function
---------