Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jun 2004
    Location
    Whistler, Br. Columbia, Canada
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    credit card inputmask/format (access97)

    I have a field that holds a credit card number. I do not want to check if it is valid, however, when certain forms display this field, I want to hide part of the credit card number for security (ie: 4500-xxxx-xxxx-4030). How do I do this, only on certain forms, without affecting the data in the table?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: credit card inputmask/format (access97)

    I don't think you can do this with an input mask or format. Instead, create a calcutated column in a query:

    <code>MaskedCreditCardNo: Left([CreditCardNo],4) & "-xxxx-xxxx-" & Right([CreditCardNo],4)</code>

    and use this as control source for a text box on a form or report. If you don't want to use a query, set the control source of the text box to

    <code>=Left([CreditCardNo],4) & "-xxxx-xxxx-" & Right([CreditCardNo],4)</code>

    where CreditCardNo is the name of the field.

  3. #3
    Lounger
    Join Date
    Jun 2004
    Location
    Whistler, Br. Columbia, Canada
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: credit card inputmask/format (access97)

    Hans -

    The second suggestion is what I would like to do, and works great! Is there an easy way to keep the xxxx-xxxx from displaying in the case of a null value in that field?

  4. #4
    Lounger
    Join Date
    Jun 2004
    Location
    Whistler, Br. Columbia, Canada
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: credit card inputmask/format (access97)

    Thanks Hans - works beautifully.

    For anyone wanting to use the above - a closing parathesis is missing.

    Jon

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: credit card inputmask/format (access97)

    Edited by HansV - missing closing parenthesis added

    You can use this:

    <code>=IIf(IsNull([Credit]CardNo),Null,Left([CreditCardNo],4) & "-xxxx-xxxx-" & Right([CreditCardNo],4))</code>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: credit card inputmask/format (access97)

    Thanks for pointing out the error; I have corrected it (adding a note about the change)

Posting Permissions

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