Such a simple answer! I wish I knew it

Noreene Patrick

Registered User.
Local time
Today, 16:32
Joined
Jul 18, 2002
Messages
223
I have a form that requires date, picker id, no of pallets, and a unique identifier (which is date + no of pallets). On my form, there is an unbound text box (displaydate) that takes the date field and converts it into a number, format([date], "mmddyy") so that 04/15/05 looks like 041505. And lets say the no of pallets would be 1961.

In the unique identifier field, my code is:
me.identifier.value = str(me.displaydate.value & me.nopallets.value) which should give me 0415051961. First problem is it doesnt put in the first 0 in the date, it puts 415051961. And I also wanted it to put in an - between display date and no of pallets to look like 041505-1961.

I tried the code several different ways such as str(me.displaydate.value & "-" & me.nopallets.value) which gave me an error.

So could you give me some suggestions? Thanks Noreene
 
Try:

Code:
me.identifier.value = Cstr(Format(me.displaydate.value,"000000") & "-" &  me.nopallets.value)
 
Thank you, boblarson!!!! That was perfect! But, what does cstr actually do?
 
Cstr converts an expression to a string. And since me.displaydate.value is not actually a number, but an expression with a value you can't use just str() to do the conversion.
 
Thank you so much for your help. I would not have come up with the answer on my own.

Noreene
 

Users who are viewing this thread

Back
Top Bottom