INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Show DB data in MaksEdBox

Show DB data in MaksEdBox

(OP)
Trying to show data from DB in MaskEdBox - phone number.

Following steps from MaskedBox for Phone I have this code:

CODE

With MyRecordSet
    ...
    mebPhone.Mask = ""        '1
    mebPhone.Text = ""        '2
    mebPhone.Text = !SUPERV_PHONE.Value    '3
    mebPhone.Mask = "(###)###-####"        '4
    ....
End With 

Line 1 - should eliminate Mask, I guess, but after executing this line, box shows (___) ___-____ (initial mask)
Line 2 - box shows empty. Great!
Line 3 - box shows 1235551212, data from DB, great!
Line 4 - data gone, box shows mask: (___) ___-____, no data sad

So what should I do to populate MaskEdBox and show the phone as (123) 555-1212?

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Show DB data in MaksEdBox

How about something like;

CODE -->

MaskEdBox1.Format = ""       '1
MaskEdBox1.Text = ""        '2
    
MaskEdBox1.Format = "(###)###-####"  '3
MaskEdBox1.Text = "1235551212"  '4 

RE: Show DB data in MaksEdBox

(OP)
Run-time error '380': Invalid Property Value sad

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Show DB data in MaksEdBox

Sorry Andy but I get no error when I run the code from a command button click. The required format is shown when the MaskedEditBox (MEB) does not have focus, when it does have focus the plain unformatted number is shown. Tested (and re-tested) using a new Form with a new Command button, a new MEB and a new TextBox; the latter allowing the MEB to loose focus without having the click the command button again.

RE: Show DB data in MaksEdBox

(OP)
This seams to work for me:

CODE

With MyRecordSet
    ...
    mebPhone.Mask = ""
    'mebPhone.Text = ""
    mebPhone.Text = Format(!SUPERV_PHONE.Value, "(###)###-####")
    mebPhone.Mask = "(###)###-####"
    ....
End With 

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Show DB data in MaksEdBox

Looks like you got it!

RE: Show DB data in MaksEdBox

(OP)
HughLerwill,
Your answer from 5 Nov 16 11:00 works if no Mask is established for the MaskEdBox, but I like to keep the Mask so user will know I need the phone number in certain format - which Mask demands from user.

Have fun.

---- Andy

There is a great need for a sarcasm font.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close