Not finding this in Archive

dcavaiani

Registered User.
Local time
Today, 15:13
Joined
May 26, 2014
Messages
385
In my form vba I calculate aN UNBOUND variable which spans multiple entry records. How do I get that "rolling" value to appear in an unbound text field on the form ?
 
Maybe you can show us the VBA, so we see what to suggest?
 
Code:
I want the "rolling" value of Sliptotal field to appear on the form in an unbound text field

Code:
Private Sub unitprice_LostFocus()
Dim OHratex As Variant
Dim OHamountx As Variant
Dim Taxx As Variant
Dim extendedx As Variant
Dim SlipTotal As Variant
Dim SaveSlipVendor As Variant
Dim SaveSlipInvoice As Variant
Dim SaveSlipDate As Variant
If SaveSlipVendor = "" Then '1st cycle is BLANK so can fill it
SaveSlipVendor = Me!VendorName
SaveSlipDate = Me!PurchaseDate
SaveSlipInvoice = Me!VendorInvoice
End If
' Figure tax before O/H Amount
If Me.taxable = "y" Then
   Taxx = ((Me!qty * Me!UnitPrice) * 0.06)
   Else
   Taxx = 0
   End If
   Tax = Taxx
extendedx = Me.qty * Me.UnitPrice
extended = extendedx
OHratex = DLookup("rate", "Rates", "Customer='" & Me.Customer & "' AND ratecode='" & "M" & "' AND saturdaystart<= #" & Me.PurchaseDate & "# AND fridayend>= #" & Me.PurchaseDate & "#")
OHamountx = (extended + Tax) * OHratex
OHrate = OHratex
OHamount = OHamountx
'Check Now to see if a SLIP TOTAL NEEDS TO BE ADDED UP
If SaveSlipVendor = Me!VendorName And SaveSlipDate = Me!PurchaseDate And SaveSlipInvoice = Me!VendorInvoice Then
SlipTotal = (SlipTotal + Tax + extended)  'Accumulate until new SLIP started
Else
SlipTotal = (Tax + extended) 'Start Over w/o a runninf total
SaveSlipVendor = Me!VendorName
SaveSlipDater = Me!PurchaseDate
SaveSlipInvoice = Me!VendorInvoice
End If
End Sub
 
Last edited:
Sounds like you could either change your sub into a function so you can return the rolling total or save it to a global variable or TempVar, so you can access it somewhere else.
 

Users who are viewing this thread

Back
Top Bottom