Re: runtime error with Mask edit control
- From: "WB" <none>
- Date: Thu, 8 Sep 2005 12:18:04 -0700
1. This is copy and paste code. I wouldn't have retyped it. Notice the
indentation. That is also indented in the code, and pasted exactly as it
was cut.
2. The error is raised as stated in original message when mask edit control
(mebDOB) is filled with data from the database.
3. DateOfBirth property is a string. When read, it is formatted as
format(mstrDOB, "Short Date")
4. All underlying variables are strings
5. If no value is entered into the Property, the database stores a null.
6. GetMaskDate is a function that allows the mask to be set to an empty
string "", and then when the mask is needed it can be set correctly through
this function call. Note, ClearMaskControl and GetMaskDate work together.
7. DateOfBirth is stored in the database as a datetime value.
8. SQL will take the string values passed into the table and convert them
into the datetime type.
The problem again is when retrieving a date such as 01/01/2005, the value
being placed into the mask control as stored in the DateOfBirth property was
1/1/2005.
The error was being generated because the mask is ## / ## / ####.
Because the default value for the system short date format is m/d/yyyy, when
I change the system short date format to mm/dd/yyyy the error goes away.
I hope this helps clarify the issue.
WB
"MikeD" <nobody@xxxxxxxxxxx> wrote in message
news:%23cUuT2CsFHA.1172@xxxxxxxxxxxxxxxxxxxxxxx
>
> "WB" <none> wrote in message news:uLuGTZBsFHA.4072@xxxxxxxxxxxxxxxxxxxxxxx
> > Here is the code where the error gets raised.
> >
> > If .DateOfBirth <> "" Then
> > mebDOB.Text = .DateOfBirth
> > Else
> > Call ClearMaskControl(mebDOB)
> > mebDOB.mask = GetMaskDate
> > End If
> >
> > The DateOfBirth is a property of an employee object. It gets filled in
> > from
> > a call to the database. If there is a value in the database field then
> > the
> > property will have data. The data is returned as a string "mm/dd/yyyy".
> > Does that help you?
>
>
> You just posted enough code to raise more questions. <g>
>
> What is the line of code on which the error occurs? What is the data type
> of your DateOfBirth property and if it has an underlying variable, what is
> its data type (one would assume the same as the property, but you never
> know)? You said this property gets filled in if the field has a value. If
> there's no value in the database, is it a NULL (which would only be
possible
> if the data type is a Variant) or something else (like a 0-length string)?
>
> What is GetMaskDate? It's obviously a function, but what is the code for
it
> and what does it return (value and data type)? You said you were getting
an
> invalid property value error, correct? It's possible that whatever is
being
> returned by your GetMaskDate function is not a valid string that can be
> assigned to the Mask property. If so, this would have NOTHING to do with
> the system date format.
>
> When you say the data is returned as a string, exactly what are you
> referring to? Is the database field a string? What IS the data type of
the
> database field? You might even need to post your code which assigns a
value
> to your DateOfBirth property.
>
> IOW, you really haven't provided enough information to make much of any
kind
> of absolute determination as to why you're getting the error. There's
still
> a number of things it could be.
>
> Also, that is not copied and pasted code. You should always copy and
paste
> so that what you're posting is EXACTLY what you've written. Quite often,
> when you re-type the code, you inadvertantly "fix" whatever problem there
> was with the code as written in VB. I can tell it's most likely not
copied
> and pasted because "mebDOB.mask" should be "mebDOB.Mask" (VB would have
> automatically formatted the code to capitalize Mask, unless you have that
as
> another property/variable/function name elsewhere in your program written
as
> "mask").
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>
.
- Follow-Ups:
- Re: runtime error with Mask edit control
- From: Ken Halter
- Re: runtime error with Mask edit control
- References:
- runtime error with Mask edit control
- From: WB
- Re: runtime error with Mask edit control
- From: Ken Halter
- Re: runtime error with Mask edit control
- From: WB
- Re: runtime error with Mask edit control
- From: MikeD
- Re: runtime error with Mask edit control
- From: WB
- Re: runtime error with Mask edit control
- From: MikeD
- runtime error with Mask edit control
- Prev by Date: Re: Address of a serial port with vb6
- Next by Date: Re: runtime error with Mask edit control
- Previous by thread: Re: runtime error with Mask edit control
- Next by thread: Re: runtime error with Mask edit control
- Index(es):
Relevant Pages
|