Converting Numbers to Text

Local time
Today, 05:11
Joined
Sep 29, 2003
Messages
25
Hello,
I have been making a report for a local shop. i have made a query for day to day view and its perfect except one thing. numbers to text. i need to convert:

0 = Cash
255 = Cash
1 = Cheque
2 = Credit Cards
3 = XMAS Clube

Please help
 
Create an unbound text box on your report and call it TxtConv. Now place this code in the report changing YourControl to the name of the control that holds the numbers, and hide that control.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.YourControl = 0 Then Me.TxtConv = "Cash"
    If Me.YourControl = 255 Then Me.TxtConv = "Cash"
    If Me.YourControl = 1 Then Me.TxtConv = "Cheque"
    If Me.YourControl = 2 Then Me.TxtConv = "Credit Cards"
    If Me.YourControl = 3 Then Me.TxtConv = "XMAS Clube"

End Sub
HTH
 
___ said:
Create an unbound text box on your report and call it TxtConv. Now place this code in the report changing YourControl to the name of the control that holds the numbers, and hide that control.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.YourControl = 0 Then Me.TxtConv = "Cash"
    If Me.YourControl = 255 Then Me.TxtConv = "Cash"
    If Me.YourControl = 1 Then Me.TxtConv = "Cheque"
    If Me.YourControl = 2 Then Me.TxtConv = "Credit Cards"
    If Me.YourControl = 3 Then Me.TxtConv = "XMAS Clube"

End Sub
HTH


Thankyou so much. ill try that. it sound like itll work.

cheers

Daniel
 
Pat Hartman said:
I would make a table with two columns.

tblPaymentType
PaymentTypeID
PaymentTypeDesc

Then join to this table in a query any time you want to show the text value:

Select ...., tblPaymentType.PaymentTypeDesc
From YourTable Left Join tblPaymentType on YourTable.PaymentTypeID = tblPaymentType.PaymentTypeID;

You can also create a query to use as the RowSource of a combo to allow the user to choose from a descriptive value rathar than having to remember each numeric value.

Select PaymentTypeID, PaymentTypeDesc
From tblPaymentType
Order By PaymentTypeDesc;

Sounds good....But ive done it now. works vey well
 

Users who are viewing this thread

Back
Top Bottom