B
BarryC
I have a user-defined function in a query. The function is defined in a
module. It is as follows:
Option Compare Database
Global uidUser As Double
Public Function UserSession() As Double
UserSession = uidUser
End Function
The query looks like this:
SELECT ShiftTable1.Week, Sum(ShiftTable1.AvgOfUtilization1) AS
SumOfAvgOfUtilization1 FROM ShiftTable1
WHERE (((ShiftTable1.UID)=UserSession()))
GROUP BY ShiftTable1.Week;
When executed, the query returns no rows, even though there are
matching rows in the queried table and the debug window shows that
uidUser and UserSession are populated with the correct value.
When the actual value of UserSession is copied from the debug window
and used in the query, the query correctly returns rows.
How do I fix this?
module. It is as follows:
Option Compare Database
Global uidUser As Double
Public Function UserSession() As Double
UserSession = uidUser
End Function
The query looks like this:
SELECT ShiftTable1.Week, Sum(ShiftTable1.AvgOfUtilization1) AS
SumOfAvgOfUtilization1 FROM ShiftTable1
WHERE (((ShiftTable1.UID)=UserSession()))
GROUP BY ShiftTable1.Week;
When executed, the query returns no rows, even though there are
matching rows in the queried table and the debug window shows that
uidUser and UserSession are populated with the correct value.
When the actual value of UserSession is copied from the debug window
and used in the query, the query correctly returns rows.
How do I fix this?