Marv
5/23/2011 7:45:00 PM
On 5/22/2011 9:58 PM, GS wrote:
> Marv presented the following explanation :
>> I have a form with a masked edit control (me Zip) with a mask of
>> "#####-####". In the process data is entered to this control is as
>> 43065878. The data is then written to a record as part to a user
>> defined type in a field defined as 'DateRec.ZipCode as string * 9'
>> with the following statement 'DataRec.ZipCode = meZip.ClipText'.
>>
>> During the process the data is copied from the UDT field back to the
>> original input control 'DataRec.ZipCode' with the statement
>> 'meZip = format(DataRec.ZipCode,"#####-####"'. When the data field
>> contains the entire 9 characters this works fine. However, if the
>> original input was only the first 5 characters of zip code (43065)
>> (zip without the last four characters) the value of the
>> dataRec.ZidCode is '43065 ' and the statement does not work. I have
>> tied many different means to get around this without success. Any
>> ideas would be appreciated.
>>
>> Marv
>
> I've always handled this using a normal textbox control and setting the
> text format according to the length of the zip code. This is handled in
> its Change event via a Select Case construct for 5, 6, or 9 character
> zip codes. USA is 5 or 9 (5-4); Canada is 6 (3 3). Case Else handles
> invalid inputs.
>
> HTH
>
Yeah, I can do that. I just hoped there might be a better way. I liked
the idea that the original input field had the mask to guide the entry.
Marv