how to change date or number to text

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

Guest

I want to update a text field on a form by combining the contents
of 3 other fields on the form...a date field + numeric field + text field.

When i try to do this is receive a data mismatch error.

How does one change the date field and the numeric field to text before
updating the text field?

Thanks in advance!

Michael
 
mehlerm said:
I want to update a text field on a form by combining the contents
of 3 other fields on the form...a date field + numeric field + text
field.

When i try to do this is receive a data mismatch error.

How does one change the date field and the numeric field to text
before updating the text field?

Thanks in advance!

Michael

Are you using "+" or "&" to combine them? (use the latter)
 
I want to update a text field on a form by combining the contents
of 3 other fields on the form...a date field + numeric field + text
field.

When i try to do this is receive a data mismatch error.

How does one change the date field and the numeric field to text
before updating the text field?

If you want to get anything reliable or repeatable, then you really need
to be handling all value-to-text formatting yourself:

MyTextBox.ControlSource = Format(MyDateField, "yyyymmdd") & _
Format(MyNumberField, "000000.00") & _
Right(String(12,"_") & MyTextField, 12)

You can of course use plain old coercion:

MyTextBox.ControlSource = MyDateField & MyNumberField & MyTextField

but you will end up with whatever rubbish is the favourite as decided by
today's version of OLE32AUT.DLL and the user settings in the Control
Panel.

Hope that helps


Tim F
 
Back
Top