Splitting entry values into 2 separate columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an entry field (like A1111 - 1 letter 4 numbers) that I would like to
split into 2 columns in the underlying table. Is there a way to accomplish
this?

(I can't enter it as 2 and combine it because it's the key for the table.)
 
Create two controls on the form - one for each of the columns you want to
update.
Bind the controls to their fields, make them invisible, and be sure they are
not in the Tab Order

Be sure the control you are doing the entry in is Unbound.

To understand the code, we will call the controls txtCol1 and txtCol2 for
the fields to update, and txtKey for the entry.

In the After Update event of txtKey:

If Me.txtKey <> "" Then
Me.txtCol1 = Left(Me.txtKey, 1)
Me.txtCol2 = Right(Me.txtKey, 4)
End If

Also, to get the Key to display, in the Current event for the form:

Me.txtKey = Me.Col1 & Me.Col2
 
Back
Top