Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2002
    Posts
    10

    Question Unanswered: maintain input mask while clearing fields

    Problem: Maskedbox input mask lost on clearing of fields

    Hello, im trying to figure out how to maintain my input mask after i clear the masked box,
    using this:

    <code>
    frmenterdata.MaskEdBox1.Mask = ""
    frmenterdata.MaskEdBox1.Text = ""

    frmenterdata.MaskEdBox2.Mask = ""
    frmenterdata.MaskEdBox2.Text = ""
    </code>

    It loses its input mask once i press my data enter button which uses the following code:

    <code>

    Private Sub cmdenterdata_Click()
    Dim dataenter As String


    'Built-in method to add a new record
    Adodc1.Recordset.AddNew

    'clears all fields
    clear

    'clears fields that didnt clear the first time
    chkditch = "0"
    chkmv = "0"
    chkrip = "0"
    chkculverts = "0"
    chkBridges = "0"
    chkbufferzones = "0"

    'disables enterdatabutton, the reason is: if this button is pressed twice
    'an error will occur, so the error is caught before it occurs
    cmdenterdata.Enabled = False

    'Message Prompt
    dataenter = MsgBox("Please enter the data in the blank fields provided, once finished use the navigation buttons to confirm the data has been entered", vbInformation + vbOKOnly, "Data Entry Instructions")

    frmenterdata.MaskEdBox1.Mask = "##/##/##"
    frmenterdata.MaskEdBox2.Mask = "####-##-###"

    End Sub

    </code>


    Note: the 2 MaskedBox's are linked to my data control

    Anyone have any solutions on how i can maintain my input masks while still clearing my fields??

    Thanks in advance

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Just reapply the mask property after you have cleared the mask/text

  3. #3
    Join Date
    Aug 2002
    Location
    Kampala, Uganda - East Africa
    Posts
    13

    Exclamation LOSS of mask after entering data!!!

    I have the same problem. Has anyone givrn u a solution?

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Sef,

    After entering data or deleting data ?

  5. #5
    Join Date
    Aug 2002
    Posts
    10

    Lightbulb Solution?

    Try something like this:

    <code>
    frmenterdata.MaskEdBox1.Mask = " / / " '<--- " 2 spaces / 2 spaces / 2 spaces "
    frmenterdata.MaskEdBox1.Text = " / / " '<--- " 2 spaces / 2 spaces / 2 spaces "


    frmenterdata.MaskEdBox2.Mask = " - - " '<--- " 4 spaces / 2 spaces / 3 spaces"
    frmenterdata.MaskEdBox2.Text = " - - " '<--- " 4 spaces / 2 spaces / 3 spaces"

    </code>

  6. #6
    Join Date
    Aug 2002
    Posts
    10

    solution?

    The above code is in my clearing method, so far it works!

Posting Permissions

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