how to change date or number to text

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
 
R

Rick Brandt

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)
 
T

Tim Ferguson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top