J
Joe Cilinceon
Ok I have included the code that I'm using below. It does work with only one
problem, it will not line up correctly. Now I'm figureing is possebly the
fonts used as they are proportional and fixed width. I could be wrong but
would love to be able to line this up correctly.
Here is an example of what I want
Rent $100.00 (I want these to line up)
Late Fee $18.00
NSF Fee 0.00 (don't show this line if value is 0)
Now I' got it down how to stop the row from printing fine it is the spacing
for the line. I can't get the Item to line up on the Left edge with the
charge lined up on the right edge. I hope that is clear and the code I got
someone site.
Option Compare Database
Option Explicit
Function ChargeBlock$(RNT, ADM, LOK, PLF, PLC, PAF, NFC, PBD, PMC, PCE, PCA)
Dim rt$, ad$, lk$, CR$
Dim lf$, lc$, af$, bd$, cf$
Dim mc$, ce$, ca$
Dim LL, L1, L2 As Integer
LL = 130
CR$ = Chr(13) & Chr(10) 'Carriage Return
If ISB(RNT) Then
rt$ = ""
Else
L1 = Len("Rent")
L2 = Len(Trim(Format(RNT, "$####.00")))
rt$ = "Rent" & Space(LL - (L1 + L2)) & Format(RNT, "$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(ADM) Then
ad$ = ""
Else
L1 = Len("Administration Fee")
L2 = Len(Trim(Format(ADM, "$####.00")))
ad$ = "Administration Fee" & Space(LL - (L1 + L2)) & Format(ADM,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(LOK) Then
lk$ = ""
Else
L1 = Len("Lock")
L2 = Len(Trim(Format(LOK, "$####.00")))
lk$ = "Lock" & Space(LL - (L1 + L2)) & Format(LOK, "$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PLF) Then
lf$ = ""
Else
L1 = Len("Late Fees")
L2 = Len(Trim(Format(PLF, "$####.00")))
lf$ = "Late Fees" & Space(LL - (L1 + L2)) & Format(PLF, "$####.00")
& CR$
End If
L1 = 0
L2 = 0
If ISB(PLC) Then
lc$ = ""
Else
L1 = Len("Lock Cut")
L2 = Len(Trim(Format(PLC, "$####.00")))
lc$ = "Lock Cut" & Space(LL - (L1 + L2)) & Format(PLC, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(PAF) Then
af$ = ""
Else
L1 = Len("Auction Fee")
L2 = Len(Trim(Format(PAF, "$####.00")))
af$ = "Auction" & Space(LL - (L1 + L2)) & Format(PAF, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(NFC) Then
NFC = ""
Else
L1 = Len("NFC Fee")
L2 = Len(Trim(Format(NFC, "$####.00")))
cf$ = "NFC Fee" & Space(LL - (L1 + L2)) & Format(NFC, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(PBD) Then
PBD = ""
Else
L1 = Len("Previous Balance Due")
L2 = Len(Trim(Format(PBD, "$####.00")))
bd$ = "Previous Balance Due" & Space(LL - (L1 + L2)) & Format(PBD,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PMC) Then
PMC = ""
Else
L1 = Len("Misc. Charges")
L2 = Len(Trim(Format(PMC, "$####.00")))
mc$ = "Misc. Charges" & Space(LL - (L1 + L2)) & Format(PMC,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PCE) Then
PCE = ""
Else
L1 = Len("Credit Earned")
L2 = Len(Trim(Format(PCE, "$####.00")))
ce$ = "Credit Earned" & Space(LL - (L1 + L2)) & Trim(Format(PCE,
"$####.00")) & CR$
End If
L1 = 0
L2 = 0
If ISB(PCA) Then
PCA = ""
Else
L1 = Len("Credit Applied")
L2 = Len(Trim(Format(PCA, "$####.00")))
ca$ = "Credit Applied" & Space(LL - (L1 + L2)) & Format(PCA,
"$####.00") & CR$
End If
ChargeBlock = rt$ & ad$ & lk$ & lf$ & lc$ & af$ & cf$ & bd$ & mc$ & ce$
& ca$
End Function
Function ISB(V) As Integer
If IsNull(V) Or V = "" Then
ISB = True
Else
ISB = False
End If
End Function
problem, it will not line up correctly. Now I'm figureing is possebly the
fonts used as they are proportional and fixed width. I could be wrong but
would love to be able to line this up correctly.
Here is an example of what I want
Rent $100.00 (I want these to line up)
Late Fee $18.00
NSF Fee 0.00 (don't show this line if value is 0)
Now I' got it down how to stop the row from printing fine it is the spacing
for the line. I can't get the Item to line up on the Left edge with the
charge lined up on the right edge. I hope that is clear and the code I got
someone site.
Option Compare Database
Option Explicit
Function ChargeBlock$(RNT, ADM, LOK, PLF, PLC, PAF, NFC, PBD, PMC, PCE, PCA)
Dim rt$, ad$, lk$, CR$
Dim lf$, lc$, af$, bd$, cf$
Dim mc$, ce$, ca$
Dim LL, L1, L2 As Integer
LL = 130
CR$ = Chr(13) & Chr(10) 'Carriage Return
If ISB(RNT) Then
rt$ = ""
Else
L1 = Len("Rent")
L2 = Len(Trim(Format(RNT, "$####.00")))
rt$ = "Rent" & Space(LL - (L1 + L2)) & Format(RNT, "$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(ADM) Then
ad$ = ""
Else
L1 = Len("Administration Fee")
L2 = Len(Trim(Format(ADM, "$####.00")))
ad$ = "Administration Fee" & Space(LL - (L1 + L2)) & Format(ADM,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(LOK) Then
lk$ = ""
Else
L1 = Len("Lock")
L2 = Len(Trim(Format(LOK, "$####.00")))
lk$ = "Lock" & Space(LL - (L1 + L2)) & Format(LOK, "$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PLF) Then
lf$ = ""
Else
L1 = Len("Late Fees")
L2 = Len(Trim(Format(PLF, "$####.00")))
lf$ = "Late Fees" & Space(LL - (L1 + L2)) & Format(PLF, "$####.00")
& CR$
End If
L1 = 0
L2 = 0
If ISB(PLC) Then
lc$ = ""
Else
L1 = Len("Lock Cut")
L2 = Len(Trim(Format(PLC, "$####.00")))
lc$ = "Lock Cut" & Space(LL - (L1 + L2)) & Format(PLC, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(PAF) Then
af$ = ""
Else
L1 = Len("Auction Fee")
L2 = Len(Trim(Format(PAF, "$####.00")))
af$ = "Auction" & Space(LL - (L1 + L2)) & Format(PAF, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(NFC) Then
NFC = ""
Else
L1 = Len("NFC Fee")
L2 = Len(Trim(Format(NFC, "$####.00")))
cf$ = "NFC Fee" & Space(LL - (L1 + L2)) & Format(NFC, "$####.00") &
CR$
End If
L1 = 0
L2 = 0
If ISB(PBD) Then
PBD = ""
Else
L1 = Len("Previous Balance Due")
L2 = Len(Trim(Format(PBD, "$####.00")))
bd$ = "Previous Balance Due" & Space(LL - (L1 + L2)) & Format(PBD,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PMC) Then
PMC = ""
Else
L1 = Len("Misc. Charges")
L2 = Len(Trim(Format(PMC, "$####.00")))
mc$ = "Misc. Charges" & Space(LL - (L1 + L2)) & Format(PMC,
"$####.00") & CR$
End If
L1 = 0
L2 = 0
If ISB(PCE) Then
PCE = ""
Else
L1 = Len("Credit Earned")
L2 = Len(Trim(Format(PCE, "$####.00")))
ce$ = "Credit Earned" & Space(LL - (L1 + L2)) & Trim(Format(PCE,
"$####.00")) & CR$
End If
L1 = 0
L2 = 0
If ISB(PCA) Then
PCA = ""
Else
L1 = Len("Credit Applied")
L2 = Len(Trim(Format(PCA, "$####.00")))
ca$ = "Credit Applied" & Space(LL - (L1 + L2)) & Format(PCA,
"$####.00") & CR$
End If
ChargeBlock = rt$ & ad$ & lk$ & lf$ & lc$ & af$ & cf$ & bd$ & mc$ & ce$
& ca$
End Function
Function ISB(V) As Integer
If IsNull(V) Or V = "" Then
ISB = True
Else
ISB = False
End If
End Function