Date gone from Masked Edit when form looses focus

I have a Masked Edit control on a form that stores a Date.  When closing the form or moving from one form to another, the date disappears.  When moving from one record to another, one can see the dates... as long as they were entered in that current session of the form.

Once the form closes, and re-opens, the date no longer appears in the date (masked edit) box.  I do not loose it from the Access table, it just doesn't appear on my form.

If I re-enter the date and move from record to record, the date is stored and appears from record to record.

If I move to a Previous or Next Form, and then back to the form with the dates, I can see all the other data but the dates.

How can I prevent this?

KathyBrowningAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GustavoValdesCommented:
Are the controls in bound or unbound mode?
0
KathyBrowningAuthor Commented:
GustavoValdes:

They are bound to one of the four data controls on the form.

0
tirupur_selvaCommented:
Since you are using four data controls, the exact data control bound may be changed during run time(may be, accidentally or some bug in code).
You are using vb5 or vb6?. If its vb6, you can use the DTPicker control that comes with the VB6 Enterprise Edition. That would be verymuch handy.

Further, try to avoid binding and use the unbound method.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

KathyBrowningAuthor Commented:
Perhaps this will help.  Here are the properties of my Masked Edit Control.

Lookup Information ... datPersonnel
Store Date to Control ... datProjects

AllowPrompt     True
ClipMode        0
DataBindings
DataField       datProjects
DataSource      DateContract
Format          dddddd
Mask            ##-##-####
MaxLength       10
PromptInclude   True


0
KathyBrowningAuthor Commented:
Ignore comment about lookup information..data control
0
tirupur_selvaCommented:
In the above, the Format & Mask property are contradicting. The format should be either "dd-mm-yyyy" or "mm-dd-yyyy". If, after this it is not functioning, put complete code here.
0
KathyBrowningAuthor Commented:
tirupur:

I'm having problems understanding.  If I put dd-mm-yyyy in the mask field, then when the user opens the form it shows:

Date ...dd-mm-yyyy...

Currently it displays as..

Date ....  -  -    .......

Maybe if you know that I need a long date, you can give me the correct and non-contradicting mask and format.

Thanks.
0
GustavoValdesCommented:
Forget about the format, just use the Mask, in this case, tell the control to have a mask with the date format you want, "dd-mm-yyyy", then, in the database, set the lenght of the field to 8 characters of date/time, and finally set two properties of the mask edit control to false, they are:

    ClipMode = 1 --> Exclude Literals
    PromptInclude = False

This properties are to prevent the control to interpret the date separators as part of the date itself.

Maybe, this is, the problem why your date is gone away, maybe it's not a bug, just that the control couldn't understand the format of the date.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GustavoValdesCommented:
I forgot to mention, don't write anything in the length property, it will determine from the Mask, how long the entry could be.
0
KathyBrowningAuthor Commented:
Thanks, that worked perfect.  Can you tell me one more thing...

When I open the form I have a bunch of DBComo's.  All of them are 'blue' as if the item in the combo box is selected.  All my other fields are white.  

If I need to I'll post for this as well, but it just seems like something simple.

When entering the data, the blue is not there, however, when the form first opens, all my dbcombo fields have the text within them highlighted or selected or blue.

0
GustavoValdesCommented:
This seems to be a bug?

Here I'm guessing, just see if the AutoRedraw property of the form is set to False if it is change its value to True.

If this doen't aply and if you're using VB 5, Have you already applied the Service Pack 3?

0
KathyBrowningAuthor Commented:
Gusta:

Turns out I had to put the mask back in because my client wanted to have a mask.  Now the date I enter in the first record appears in the second and third record.  Everything is storing correctly.  When I open the close/then open the form no dates appear.  When I enter any date in any record, it appears in all records, although it only stores to that current record.

AllowPrompt     True
ClipMode        Exlude Literals
DataBindings
DataField       datProjects
DataSource      DateContract
Format          mm/dd/yy

Mask            ##/##/## (99/99/99) or (mm/dd/yy) all do not help

MaxLength       8
PromptInclude   True (no date, or same date in every record)

PromptInclude   False (date 04/05/99 appears as 45/99/__)  Changing this property does allow the date to change with the records, however, the appearance is messed up.  So it's not taking the zero's.  I need it to store the zero's in Access maybe?








0
GustavoValdesCommented:
Kathy:
      It not clear to me what is the problem you have.
                Are all the mask edit boxes working bad or the problem boxes are the one you want to repeat the same date (at least this is what I understood).

The properties must be set to:
AllowPrompt       = True
ClipMode            = Exclude Literals
Format                  = Empty
Mask                 = ##/##/####
MaxLenght         = Empty
PromptInclude       = False

Try this changes, the MaxLength property must be Empty because it determines the lenght from the Mask you specify.
If these changes make the program shows the date but with a wrong format then check the format you have specified for this date.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.