Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value turning string to number

Status
Not open for further replies.

spizotfl

MIS
Aug 17, 2005
345
US
OK, I don't believe that is quite what is happening, but I can't find where it is being changed....
Here's the situation:
I have a field called ServicesID that looks like 1-01. It is a string value. When the user adds a new record, they can continue with the same ServicesID, and I use the defaultValue property to propagate this value. The problem is that instead of 1-01 showing on the new record, it is showing 0. If I just set the value directly, instead of using DefaultValue, it shows properly. I have double checked the underlying table fields and they are all text. I have tried changing the code that sets it from:
Me.txtServicesID.DefaultValue = servID
to:
Me.txtServicesID.DefaultValue = "" & servID & ""
but it still resolves it as numeric values. ServID is a string variable declared at the form level. It receives its value from OpenArgs when the form loads.
What am I missing?




"Maturity is a bitter disappointment for which no remedy exists, unless laughter can be said to remedy anything."
-Vonnegut
 
Thanks for the quick response.
That works, but any ideas why that would work and what I was doing wasn't? That doesn't seem like the intuitive step one would expect just to set a string property with a string variable....

"Maturity is a bitter disappointment for which no remedy exists, unless laughter can be said to remedy anything."
-Vonnegut
 
I think this works too:

"'" & ServID & "'"

Pampers [afro]
Keeping it simple can be complicated
 
you could also try using str([servid])


Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top