D
DW
Got a little problem with goto line
I have got a text box that is bound that I am trying to get to increase in
number by 1 for each record until it gets to 4 then close the form. I have
tried it several ways and I am still having problems. The textbox is locked
so no one can enter data into it. The form that it is on has 3 other bound
textboxes related to the same record. This code is in the first textbox to
receive focus when the form loads. It will change the value from 0 to 1, but
after that it wont. I unlocked the textbox for spite and put a 2 in and when
you click on the textbox that this code is in it will change the number. How
come it wont if you tab through the form. I t looks like it would when the
textbox receives focus.
Stumped!
Private Sub
Calibration_Begining_Meter_Readings_GotFocus()
If Text16.Value = 0 Then GoTo line1
If Text16.Value = 1 Then GoTo line2
If Text16.Value = 2 Then GoTo line3
If Text16.Value = 3 Then GoTo line4 Else GoTo line5
line1:
Text16.DefaultValue = ""
Text16.Value = 1
GoTo lastline
line2:
Text16.Value = 2
GoTo lastline
line3:
Text16.Value = 3
GoTo lastline
line4:
Text16.Value = 4
GoTo lastline
line5:
Beep
lastline:
Beep
End Sub
the close statement is on the last textbox to recieve focus. The code is in
the exit event
if text16.value = 4 then
DoCmd.Close.ACForm, (calibration)
I have got a text box that is bound that I am trying to get to increase in
number by 1 for each record until it gets to 4 then close the form. I have
tried it several ways and I am still having problems. The textbox is locked
so no one can enter data into it. The form that it is on has 3 other bound
textboxes related to the same record. This code is in the first textbox to
receive focus when the form loads. It will change the value from 0 to 1, but
after that it wont. I unlocked the textbox for spite and put a 2 in and when
you click on the textbox that this code is in it will change the number. How
come it wont if you tab through the form. I t looks like it would when the
textbox receives focus.
Stumped!
Private Sub
Calibration_Begining_Meter_Readings_GotFocus()
If Text16.Value = 0 Then GoTo line1
If Text16.Value = 1 Then GoTo line2
If Text16.Value = 2 Then GoTo line3
If Text16.Value = 3 Then GoTo line4 Else GoTo line5
line1:
Text16.DefaultValue = ""
Text16.Value = 1
GoTo lastline
line2:
Text16.Value = 2
GoTo lastline
line3:
Text16.Value = 3
GoTo lastline
line4:
Text16.Value = 4
GoTo lastline
line5:
Beep
lastline:
Beep
End Sub
the close statement is on the last textbox to recieve focus. The code is in
the exit event
if text16.value = 4 then
DoCmd.Close.ACForm, (calibration)