I am using Access 2000 on a Windows 2000 Professional machine, and am having a slight problem when using a function for my recordsource on certain text boxes. I have done this before but can't remember what I did to make it work (it's been a few years since I used Access).
I have a number of text boxes on my two detail lines that are numeric fields, and I don't want to change my query to alter the values of the fields for other reasons. I am using a fuction called ConvertAmt to either move "" to the box or a formatted string depending on the input. Here is my recordsource:
=ConvertAmt(CDbl([DiscountPrice]), "Amt"
And here is the function which is in a module of the database (and not the report) called Standard:
Function ConvertAmt(CnvAmt As Double, CnvType As String) As String
If CnvAmt = 0 Then
ConvertAmt = ""
ElseIf CnvType = "Pct" Then
ConvertAmt = Format$(CnvAmt, "##0.000000"
ElseIf CnvType = "Amt" Then
ConvertAmt = Format$(CnvAmt, "$###,###,##0.00"
ElseIf CnvType = "Qty" Then
ConvertAmt = Format$(CnvAmt, "#,###,##0"
End If
End Function
When the value is 0, it is putting a "" in the text box, but it is also putting a blank in there when the field has $150.00 in it coming from the query. Is there a way for me to see what's going on? When I set a break to the function in the debugger and then run the report, it never goes inside the function. Is there something I am missing?
Thanks,
Mike
I have a number of text boxes on my two detail lines that are numeric fields, and I don't want to change my query to alter the values of the fields for other reasons. I am using a fuction called ConvertAmt to either move "" to the box or a formatted string depending on the input. Here is my recordsource:
=ConvertAmt(CDbl([DiscountPrice]), "Amt"
And here is the function which is in a module of the database (and not the report) called Standard:
Function ConvertAmt(CnvAmt As Double, CnvType As String) As String
If CnvAmt = 0 Then
ConvertAmt = ""
ElseIf CnvType = "Pct" Then
ConvertAmt = Format$(CnvAmt, "##0.000000"
ElseIf CnvType = "Amt" Then
ConvertAmt = Format$(CnvAmt, "$###,###,##0.00"
ElseIf CnvType = "Qty" Then
ConvertAmt = Format$(CnvAmt, "#,###,##0"
End If
End Function
When the value is 0, it is putting a "" in the text box, but it is also putting a blank in there when the field has $150.00 in it coming from the query. Is there a way for me to see what's going on? When I set a break to the function in the debugger and then run the report, it never goes inside the function. Is there something I am missing?
Thanks,
Mike