Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Maskeditboxes.....

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have 4 maskeditbox on my forms to display and enter formatted dates and are linked to 4 date fields on my ado database. When i do a movelast on my ado recordset, the maskeditboxes are popluated with some data that's not even the last record on my recordset and I expect them to be blanks. This is not the case when I changed these maskeditboxes to a text box, which display blank.
Can anybody tell me why this is happening and how I can correct it.

Any help will be greatly appreciated
 
Hi Mate!

I had lots of troble with using date masks in the masked boxes. I therefore set the box's as follows:

Private Sub dtpStart_KeyPress(KeyAscii As Integer)
dtpStart.Mask = "##/##/####"
End Sub

Private Sub dtpStart_LostFocus()
dtpStart.Mask = ""
End Sub

This works a charm!!! Found it by accident, when playing around with them.

Gerard
 
Thanks krill,

I have that too on my data entry form. I'm having this problem in my update form, where the boxes are bound to a recordset and there is no way I can trap the keypress and gotfocus events.
I want to have an empty form when the user gets in there.
But when I do a movelast on my recordset, the maskeditboxes are still populated with data eventhough the record is blank.
I got this error message, when the database field for one of the maskeditbox is empty.
"unable to bind to field or datamember."
 
If you treat the makboxs as plan text boxes with no mask set do you still get the same problem?
 
It might happen because of EOFAction is set to AddNew. Try to set it to MoveLast or consider default date for new records. In order to implement the latter you will need to modify design of the particular table(s). When new record is created and no default date is available then some garbage, probalbly something like "12:00:00 AM" goes to this data field. This is fine for your table but does not math the mask of your control.

Vlad
 
thanks guys for your help.

I decided to change my maskeditboxes to plain text boxes, it's so bothersome to bound it to a recordset. The only reason i made them meb in the first place is so that user have a visual representation of what the format is, but since it is bound to a field that is already formatted the way it is, i'll just deal with the validation issue when i come across it.

thanks again for your responses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top