I need code to increment a value using a counter.
I have a form that the user enters information when a customer purchase a brick with an inscription. The customer can buy as many bricks as they choose to. if a customer purchase more than one brick with different inscriptions the user need to be able to add the customer and the only field that changes is the inscription field. for instance if a customer buys 3 bricks. there is a check box called MultipleBricks that they check and then there is a field called TotalBricksPurchased. they would enter a 3. and then they would enter the price in a field called TotalPrice and hit save. NOw.....when they hit save i need the inscription field (only) to be emptied and a lil message box that says 1 of 3 and then they enter another inscription and hit save and the inscription field is emptied again and then the message box says 2 of 3 and so on.
here is the code I have but not getting the right results...
Dim Counter As Integer
Counter = 0
If Me.TotalBricksPurchased > 1 And MultipleBricks = -1 Then
Do
Counter = Counter + 1
Loop While (Counter < TotalBricksPurchased)
MsgBox Counter & " of " & TotalBricksPurchased
End If
If MultipleBricks.Value = -1 Then
Me.Inscription = ""
rstTrans.Requery
End If
I have a form that the user enters information when a customer purchase a brick with an inscription. The customer can buy as many bricks as they choose to. if a customer purchase more than one brick with different inscriptions the user need to be able to add the customer and the only field that changes is the inscription field. for instance if a customer buys 3 bricks. there is a check box called MultipleBricks that they check and then there is a field called TotalBricksPurchased. they would enter a 3. and then they would enter the price in a field called TotalPrice and hit save. NOw.....when they hit save i need the inscription field (only) to be emptied and a lil message box that says 1 of 3 and then they enter another inscription and hit save and the inscription field is emptied again and then the message box says 2 of 3 and so on.
here is the code I have but not getting the right results...
Dim Counter As Integer
Counter = 0
If Me.TotalBricksPurchased > 1 And MultipleBricks = -1 Then
Do
Counter = Counter + 1
Loop While (Counter < TotalBricksPurchased)
MsgBox Counter & " of " & TotalBricksPurchased
End If
If MultipleBricks.Value = -1 Then
Me.Inscription = ""
rstTrans.Requery
End If
Last edited: