I am storing safety data in an Access dB and a few of the fields contain the selected state of checkboxes on my form in 'Yes/No' data types. When I perform a SQL query the values I recieve back, for say a SUM() function are all negative. I know that the default check state value is -1 but how do I change the sign to be displayed in my report? Here is the SQL statement:
Fire, Damage, Process, and Environment are the checkboxes used to identify the type of Unusual Occurrence. When trying to display the value for the one record I only recieve 'FALSE' as my output, and for SUM() functions as above I get negative integers.VB Code:
strSQL = "SELECT SUM([Manhours]) as SafeMonthly1, SUM([First Aid]) as SafeMonthly2," _ & " SUM([Medical Aid]) as SafeMonthly3, SUM([Lost Time Accident]) as SafeMonthly4," _ & " SUM([Fatal Accident]) as SafeMonthly5, SUM([Unusual Occurrences]) as SafeMonthly6," _ & " SUM([Fire]) as SafeMonthly7, SUM([Damage]) as SafeMonthly8," _ & " SUM([Process]) as SafeMonthly9, SUM([Environment]) as SafeMonthly10" _ & " FROM Safety_Data WHERE [Date] >= #" & Month(Date) & "/01/" & Year(Date) & "#" SafetyDailyRS.Open strSQL, Connection, adOpenKeyset, adLockPessimistic, adCmdText If Not SafetyDailyRS.EOF Then oXLSheet.Range("D9").Value = SafetyDailyRS.Fields("SafeMonthly1").Value oXLSheet.Range("D10").Value = SafetyDailyRS.Fields("SafeMonthly2").Value oXLSheet.Range("D11").Value = SafetyDailyRS.Fields("SafeMonthly3").Value . . . End If
Any suggestions as to how to go about formatting this properly?




Reply With Quote