M
Mike Geoghegan
I have a table named CODES that contains the following
fields:
MainCode field length = 8
Hex1 field length = 2
Hex2 " " "
Hex3 " " "
Hex4 " " "
I would like to enter 8 digits into the "MainCode" field
and have the form automatically take the first 2 digits
and enter them in "Hex1", then the next 2 digits
into "Hex2" and so forth.
Example:
MainCode 12345678
Hex1 12
Hex2 34
Hex3 56
Hex4 78
I can get it to enter the first 2 digits into Hex1 with
this code:
Private Sub MainCode_AfterUpdate()
Dim txtCode As String
Dim Code1 As String
txtCode = Forms!keys!MainCode.Text
Forms!keys!MainCode.SetFocus
Forms!keys!hex1.SetFocus
Code1 = Forms!keys!hex1.Text
Code1 = UCase(Left(MainCode, 2))
If Forms!keys!hex1.Text = "" Then
Forms!keys!hex1 = Code1
End If
End Sub
Can someone help me?
Thanks!
fields:
MainCode field length = 8
Hex1 field length = 2
Hex2 " " "
Hex3 " " "
Hex4 " " "
I would like to enter 8 digits into the "MainCode" field
and have the form automatically take the first 2 digits
and enter them in "Hex1", then the next 2 digits
into "Hex2" and so forth.
Example:
MainCode 12345678
Hex1 12
Hex2 34
Hex3 56
Hex4 78
I can get it to enter the first 2 digits into Hex1 with
this code:
Private Sub MainCode_AfterUpdate()
Dim txtCode As String
Dim Code1 As String
txtCode = Forms!keys!MainCode.Text
Forms!keys!MainCode.SetFocus
Forms!keys!hex1.SetFocus
Code1 = Forms!keys!hex1.Text
Code1 = UCase(Left(MainCode, 2))
If Forms!keys!hex1.Text = "" Then
Forms!keys!hex1 = Code1
End If
End Sub
Can someone help me?
Thanks!