?Name# if I set DefaultValue to Text

A

Amy Blankenship

I have a text field that the client has specified will increment
hexidecimally. So, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, etc. To do this, I
have the following code in VBA
Private Sub Form_Current()
Dim newval As Variant
If Me.CurrentRecord < 10 Then
newval = Me.CurrentRecord
Else
newval = Chr(Me.CurrentRecord - 9 + 64)
End If
Me.KCategoryCode.SetFocus
Me.KCategoryCode.DefaultValue = newval
Me.KcategoryDesc.SetFocus
End Sub

If newval is a number, everything works perfectly. If it is a letter, I get
?Name# in the field. The field is set up as a 1 character text field in the
table. I can input a letter just fine by hand. If I check the value of
Me.KCategoryCode.DefaultValue in the locals or immediate window, it is
correct, but Me.KCategoryCode.Text is always ?Name#.

Any ideas?

TIA;

Amy
 
Top