Results 1 to 2 of 2

Thread: Very Odd Problem with MaskEdBox and my data??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    North Carolina
    Posts
    102

    Very Odd Problem with MaskEdBox and my data??

    I have a very puzzling problem with my data and the MaskEdBox. I have data from an Access database connected with ADO. When the form loads, 5 textboxes & 1 MaskEdBox display data. You can move through the records, add new, edit, undo and save. I am working with a very small test database(about 10 records). My MaskEdBox is for the Date. Here is the problem;when I select edit, some of the dates are displayed and for some records the date is blank. It is the same records that display date/don't display date everytime. I looked at my data to see if I could spot something out of place between the ones that don't display, but I can't see anything out of the ordinary. This is my code for Edit:
    Code:
    Case cmdedit
            Highlight Text1(1)
            With MyRecSet
                If (.EditMode = adEditNone) Then
                If (lTotalRecords > 0) Then
                        vMyBookMark = .Bookmark
                    Else
                        vMyBookMark = ""
                    End If
                    Text1(0).Locked = True
                    Text1(0).BackColor = vbYellow
                    Text1(1).Locked = False
                    Text1(1).BackColor = vbYellow
                    Text1(2).Locked = False
                    Text1(2).BackColor = vbYellow
                    Text1(3).Locked = False
                    Text1(3).BackColor = vbYellow
                    MaskEdBox1.Mask = ""
                    MaskEdBox1.BackColor = vbYellow
                    MaskEdBox1.Text = MyRecSet.Fields.Item("Date") & ""
                    MaskEdBox1.Mask = "##/##/####" 
                    Text1(5).Locked = False
                    Text1(5).BackColor = vbYellow
                    navigateButtons ("00000110000")
                    Text1(1).SetFocus
                End If
            End With
    Can anybody tell me what is going on? I can't figure out why it is doing this.
    Thanks

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Very Odd Problem with MaskEdBox and my data??

    Will you try it like this?

    VB Code:
    1. MaskEdBox1.Mask = ""
    2. MaskEdBox1.BackColor = vbYellow
    3. MaskEdBox1.Mask = "##/##/####"
    4. MaskEdBox1.Text = Format$(MyRecSet.Fields.Item("Date"), "mm/dd/yyyy")
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width