J
John G.
I'm tring to write a simple routine to automate a group's "paper 'n napkin"
bookkeeping. They have several revenue streams, coffee, copy machine,
ceramics, membership, etc. I'm setting the input up to match what they are
presently doing on paper (You know the group I'm talking about when you hear
them say "Well we've done it this way for the last 20 years..."). Enough
said.
In the situation below, they would first count the funds for the particular
item, in this case, one source of coffee income, and input the information
into a text box. Then they recount, separating out checks, cash, and coin
individually (see excuse above as to why I'm not fighting them). This is a
double check. At least I convinced them to let Excel do the math. Each of
the inputs, check, cash, and coin values, are running very similar
subroutines that total rows and columns on form and each with the exception
of the "coin" routine, see below, perform fine.
Private Sub txtCoffeeSubCoin_AfterUpdate()
txtCoffeeSubCoin.Value = Format(Val(txtCoffeeSubCoin.Value), _
"$#,##0.00") 'fomats value in current txtbox
txtCoffeeMainCoin.Value = Format(Val(Mid(txtCoffeeSubCoin.Value, 2)) + _
Val(Mid(txtBingoSubCoin.Value, 2)), "$#,##0.00") 'combines both
income sources onto main income line and formats
TotalsColCoin 'totals the coin count column
TotalsCoffeeRow 'totals the main income source line
CBBingoSub.SetFocus 'sets the focus to a checkbox that turns the
visibility of the next line item's txtboxes on
End Sub
My problem is with the SetFocus line. As mentioned, the other similar
routines seem to handle the setfocus OK, tho they are setting focus on the
next txtbox in order, but when the line in question is executed, the program
jumps back to the beginning of the subroutine and reruns itself, clearing the
entry. I've commented out the line and the routine finishes like it should
Any help is appreciated. JG
bookkeeping. They have several revenue streams, coffee, copy machine,
ceramics, membership, etc. I'm setting the input up to match what they are
presently doing on paper (You know the group I'm talking about when you hear
them say "Well we've done it this way for the last 20 years..."). Enough
said.
In the situation below, they would first count the funds for the particular
item, in this case, one source of coffee income, and input the information
into a text box. Then they recount, separating out checks, cash, and coin
individually (see excuse above as to why I'm not fighting them). This is a
double check. At least I convinced them to let Excel do the math. Each of
the inputs, check, cash, and coin values, are running very similar
subroutines that total rows and columns on form and each with the exception
of the "coin" routine, see below, perform fine.
Private Sub txtCoffeeSubCoin_AfterUpdate()
txtCoffeeSubCoin.Value = Format(Val(txtCoffeeSubCoin.Value), _
"$#,##0.00") 'fomats value in current txtbox
txtCoffeeMainCoin.Value = Format(Val(Mid(txtCoffeeSubCoin.Value, 2)) + _
Val(Mid(txtBingoSubCoin.Value, 2)), "$#,##0.00") 'combines both
income sources onto main income line and formats
TotalsColCoin 'totals the coin count column
TotalsCoffeeRow 'totals the main income source line
CBBingoSub.SetFocus 'sets the focus to a checkbox that turns the
visibility of the next line item's txtboxes on
End Sub
My problem is with the SetFocus line. As mentioned, the other similar
routines seem to handle the setfocus OK, tho they are setting focus on the
next txtbox in order, but when the line in question is executed, the program
jumps back to the beginning of the subroutine and reruns itself, clearing the
entry. I've commented out the line and the routine finishes like it should
Any help is appreciated. JG