Hello all,
I am quite new to VBA, but am learning quickly. I am trying to eventually find which day we hit our breakpoint, then post that date to a table, and any remaining sales be tallied up into a Sales after Breakpoint field. Right now I am just working on creating an equation to find our breakpoint.
Here is what I have so far:
Code:
Public Sub BreakPoint()
Dim cum_sales As Currency
Dim bp_found As String
Dim prof_postbp As Currency
Dim FindBP As Recordset
Set FindBP = CurrentDb.OpenRecordset("Totals By Date", dbOpenDynaset)
cum_sales = 0
bp_found = n
If Not FindBP.EOF Then FindBP.MoveFirst
If bp_found = n Then
Do While cum_sales - [Module Cost] < 0
FindBP.MoveNext
cum_sales = cum_sales + [Total Sales]
Loop
End If
End Sub
I do not think I am referencing records correctly and would like some help with this. I want to be using my current database, and I want the table it is accessing to be Totals By Date.
Any help is greatly appreciated!