KathyBrowning
asked on
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?
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?
Are the controls in bound or unbound mode?
ASKER
GustavoValdes:
They are bound to one of the four data controls on the form.
They are bound to one of the four data controls on the form.
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.
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.
ASKER
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
Lookup Information ... datPersonnel
Store Date to Control ... datProjects
AllowPrompt True
ClipMode 0
DataBindings
DataField datProjects
DataSource DateContract
Format dddddd
Mask ##-##-####
MaxLength 10
PromptInclude True
ASKER
Ignore comment about lookup information..data control
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.
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I forgot to mention, don't write anything in the length property, it will determine from the Mask, how long the entry could be.
ASKER
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.
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.
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?
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?
ASKER
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?
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?
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.
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.