Can someone please take a look at this piece of code? it is driving me crazy! All I want to have is three text boxes moving up as user is typing info in these textboxes, when cursor/active box stays in the middle of the form. For some reason it does not work as I want to. Here it is:
Private Sub Form_Load()
Me.lbl_fname.Top = 778
Me.lbl_fname.Visible = True
Me.txt1.Top = 1080
Me.txt1.Visible = True
Me.txt1.SetFocus
Me.lbl_lname.Top = 1498
Me.lbl_lname.Visible = True
Me.txt2.Top = 1800
Me.txt2.Visible = True
Me.lbl_address.Visible = False
Me.txt3.Visible = False
End Sub
Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.lbl_fname.Top = 58
Me.lbl_fname.Visible = True
Me.txt1.Top = 360
Me.txt1.Visible = True
Me.lbl_lname.Top = 778
Me.lbl_lname.Visible = True
Me.txt2.Top = 1080
Me.txt2.Visible = True
Me.txt2.SetFocus
Me.lbl_address.Top = 1498
Me.lbl_address.Visible = True
Me.txt3.Top = 1800
Me.txt3.Visible = True
End If
End Sub
Private Sub txt2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.txt1.Visible = False
Me.lbl_lname.Top = 58
Me.lbl_lname.Visible = True
Me.txt2.Top = 360
Me.txt2.Visible = True
Me.lbl_address.Top = 778
Me.lbl_address.Visible = True
Me.txt3.Top = 1080
Me.txt3.Visible = True
Me.txt3.SetFocus
End If
End Sub
Private Sub txt3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.txt1.Visible = False
Me.txt2.Visible = False
Me.lbl_address.Top = 58
Me.lbl_address.Visible = True
Me.txt3.Top = 360
Me.txt3.Visible = True
End If
End Sub
Private Sub Form_Load()
Me.lbl_fname.Top = 778
Me.lbl_fname.Visible = True
Me.txt1.Top = 1080
Me.txt1.Visible = True
Me.txt1.SetFocus
Me.lbl_lname.Top = 1498
Me.lbl_lname.Visible = True
Me.txt2.Top = 1800
Me.txt2.Visible = True
Me.lbl_address.Visible = False
Me.txt3.Visible = False
End Sub
Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.lbl_fname.Top = 58
Me.lbl_fname.Visible = True
Me.txt1.Top = 360
Me.txt1.Visible = True
Me.lbl_lname.Top = 778
Me.lbl_lname.Visible = True
Me.txt2.Top = 1080
Me.txt2.Visible = True
Me.txt2.SetFocus
Me.lbl_address.Top = 1498
Me.lbl_address.Visible = True
Me.txt3.Top = 1800
Me.txt3.Visible = True
End If
End Sub
Private Sub txt2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.txt1.Visible = False
Me.lbl_lname.Top = 58
Me.lbl_lname.Visible = True
Me.txt2.Top = 360
Me.txt2.Visible = True
Me.lbl_address.Top = 778
Me.lbl_address.Visible = True
Me.txt3.Top = 1080
Me.txt3.Visible = True
Me.txt3.SetFocus
End If
End Sub
Private Sub txt3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.txt1.Visible = False
Me.txt2.Visible = False
Me.lbl_address.Top = 58
Me.lbl_address.Visible = True
Me.txt3.Top = 360
Me.txt3.Visible = True
End If
End Sub