Hi!
I get a result set from a pt qry from a sql server 2008 in vba.
Me.Total is an unbound field in the report foot( correct translation of german "Berichtsfuß"??)
Private Sub Berichtsfuß_Print(Cancel As Integer, PrintCount As Integer)
SELECT SUM((DATEPART(hour, Calctime) * 60 + DATEPART(minute, Calctime)) * Price / 60) AS TtlPrice ...
Set rs = CurrentDb.OpenRecordset("qryPT_TtlPrice")
Me.Total = rs("TtlPrice ")
..
On the access report I can format me.Total as currency, decimal, integer whatever I want (unless it makes no sense exept currency) and it works.
but
SUM(((DATEPART(hour, Calctime) * 60 + DATEPART(minute, Calctime)) * Price/ 60)* (case when CompanyID=1 then 1.66 else 1 end)) AS TtlPrice
The detail should be multiplied with 1,66 when the record belongs to company 1, for all others ist remains the same.
In the Management Studio the results of both looks similar, same in ´the debug window of VBA editor, but I cannot format the result or lets say, the formating is wrong for the second example.
Neither in VBA
Me.Total = format(rs("TtlPrice "), "€ 0.000,00") or
Me.Total = format(rs("TtlPrice "),"0.000,00")
nor in the report int the properties of the field I can avoid this result:
in the debug window of access the result looks OK, for example 29555.670000 (don't know where all the 0 come from), which should read as € 29.555,67.
But on the report the result with formated curreny in field property (currency, 2 decimals) shows
€ 29.555.670.000,00
Any idea?
Thanks your help.
Michael
I get a result set from a pt qry from a sql server 2008 in vba.
Me.Total is an unbound field in the report foot( correct translation of german "Berichtsfuß"??)
Private Sub Berichtsfuß_Print(Cancel As Integer, PrintCount As Integer)
SELECT SUM((DATEPART(hour, Calctime) * 60 + DATEPART(minute, Calctime)) * Price / 60) AS TtlPrice ...
Set rs = CurrentDb.OpenRecordset("qryPT_TtlPrice")
Me.Total = rs("TtlPrice ")
..
On the access report I can format me.Total as currency, decimal, integer whatever I want (unless it makes no sense exept currency) and it works.
but
SUM(((DATEPART(hour, Calctime) * 60 + DATEPART(minute, Calctime)) * Price/ 60)* (case when CompanyID=1 then 1.66 else 1 end)) AS TtlPrice
The detail should be multiplied with 1,66 when the record belongs to company 1, for all others ist remains the same.
In the Management Studio the results of both looks similar, same in ´the debug window of VBA editor, but I cannot format the result or lets say, the formating is wrong for the second example.
Neither in VBA
Me.Total = format(rs("TtlPrice "), "€ 0.000,00") or
Me.Total = format(rs("TtlPrice "),"0.000,00")
nor in the report int the properties of the field I can avoid this result:
in the debug window of access the result looks OK, for example 29555.670000 (don't know where all the 0 come from), which should read as € 29.555,67.
But on the report the result with formated curreny in field property (currency, 2 decimals) shows
€ 29.555.670.000,00
Any idea?
Thanks your help.
Michael