A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Conditional input mask on form



 
 
Thread Tools Display Modes
  #1  
Old October 9th, 2006, 08:59 PM posted to microsoft.public.access.forms
Jon Peck
external usenet poster
 
Posts: 1
Default Conditional input mask on form

I'm largely self-taught (so hardly an expert) in Access 2002. I'm wondering
if it's possible to have a conditional input mask on a field in a form.

My database keeps track of people who register for a conference. They can
pay by credit card (Visa or MasterCard only), check or purchase order. I'd
like to be able to have an input mask so that I only have to type the digits
(1234567890123456) but the credit card numbers show up with easier-to-read
dashes in the usual spots (1234-5678-9012-3456). However, when the method of
payment is a check or purchase order, I don't want the dashes. Is it
possible to do this? I'm thinking the method, if there is one, would
involve use of the IIF function, and might be used on either the form, the
table or a query. Any guidance would be greatly appreciated. Thanks!


  #2  
Old October 9th, 2006, 09:14 PM posted to microsoft.public.access.forms
Jeff L
external usenet poster
 
Posts: 448
Default Conditional input mask on form

In After Update event of the Payment Type put

If Me.PaymentType = "Credit Card" Then
Me.AccountNum.InputMask = "0000-0000-0000-0000"
Else
Me.AccountNum.InputMask = ""
End If

Hope that helps!


Jon Peck wrote:
I'm largely self-taught (so hardly an expert) in Access 2002. I'm wondering
if it's possible to have a conditional input mask on a field in a form.

My database keeps track of people who register for a conference. They can
pay by credit card (Visa or MasterCard only), check or purchase order. I'd
like to be able to have an input mask so that I only have to type the digits
(1234567890123456) but the credit card numbers show up with easier-to-read
dashes in the usual spots (1234-5678-9012-3456). However, when the method of
payment is a check or purchase order, I don't want the dashes. Is it
possible to do this? I'm thinking the method, if there is one, would
involve use of the IIF function, and might be used on either the form, the
table or a query. Any guidance would be greatly appreciated. Thanks!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.