Click to See Complete Forum and Search --> : Masked Edit Box Problem


Carl Provost
September 11th, 1999, 08:54 AM
Hi,
I am having problems using the MaskEdBox.

I'm using VB 6.0 and MSMASK32.OCX. with an
ADO data control connected to a SQL Server 7 database, running on WinNT 4.0 workstation.

The computer's "Regional Settings" for the date are MM/dd/yyyy.

The MaskEdBox (mskBirthday) is bound to a field
"Birthday" (datatype=datetime, length=8).

The mask is: ##/##/##
The DataFormat Property is: Date - Format$ MM/dd/yy

Two problems are actually occuring:
1. Editing - after making a change to a date and trying to invoke the recordset.update method, I get the error: "The change was cancelled during notification; no columns are changed". I am unable to edit a date.
?? is that a SQL Server error ??

2. Adding a new record (AddNew method) - and then trying to invoke the recordset.update method, the error message is simply: "Errors Occured", and the record does not get added to the table. I know the problem is caused by the MaskedEdBox control, because if I use a regular textbox everything works fine.

I am new to this MaskEdBox... so any help will be greatly appreciated.

Vlad Chapranov
September 11th, 1999, 10:09 AM
I had some problems with Mask Edit. It did not clear when record did not contain any data in a field bound to that box. Maybe it will help you somehow. I solved it this way - in reposition event of DC I wrote:

With MaskEdPhone
.Refresh
If IsNull(datAccount.Recordset("[Account Phone]")) = true then
.Mask = "" 'delete mask, because text property will not be cleared without this
.Text = ""
.Mask = "(###) ###-####" 'restore mask
else
.Mask = "(###) ###-####"
End If
End With



Vlad Chapranov

Bruce Randolph
October 10th, 2001, 01:11 PM
You might want to check your properties for the masked edit control to ensure that the PromptInclude property is set to TRUE. The reason for this is the mask you are using "##/##/##" contains the literal characters "/" which are either included or excluded from the control's .Text value based on the setting of this property. If the property is set to FALSE the slashes will not be included and the actual .Text value will result in mmddyy instead of mm/dd/yy, which will generate an error when you try to update a bound date field.