Input mask problem with continuous form

NachoMan

Registered User.
Local time
Today, 20:35
Joined
Sep 28, 2003
Messages
56
Friends,
I have a contacts form which contains a subform (continuous forms) for telephone numbers. The subform is necessary since each contact will have several (3 or more) numbers each. The telephone numbers are not formatted the same way, however, since some of the numbers are international numbers. I have an option group in the subform which allows the user to select whether the phone number is domestic (9 digits) or international (13 digits). Changing this option group changes the format of the input mask for the telephone number field.

I thought this set up would work fine, but it does not. The default input mask is for domestic numbers. Say I have a first telephone record with a domestic number mask selected. When the user goes to add an additional number that requires an international number mask, the masks for ALL of the telephone number records changes to the international mask. If I then switch the domestic number back to domestic, BOTH records are switched to a domestic number mask. I can sort of understand this given the fact that the field input mask is changing instead of the specific field record. The thing that confuses me though is that if I set the subform to single form, this problem does not occur. Each record in a single form set-up retains the selected input mask.

Am I explaining the problem clearly? If so, is there anyway I can achieve what I'm trying to do here. If not, I'm open to alternate suggestions.
Thanks in advance.

-Lou
 
The text box in the Details section on a Continuous form will repeat/copy down for each record, thus copying all of it properties, so when you change the input mask of the text box it will apply it all down the page for every single record.
Now, if you are using Access 2000 or later you can utilize a new method called "FormatConditions", this method should allow you to conditionally apply the format of the text box on a record by record basis.

I use "FormatConditions" for changing font colors if the contained data meets a certain criteria, see the following:
Code:
    With Me.Controls("txtProjectName").FormatConditions.Add(acExpression, , "(isnull([txtStatus]) or [txtStatus]='Unknown') AND [txtStatus]<>'Completed'")
'        .FontBold = True
        .ForeColor = 255
        .Enabled = False
    End With
you should be able to use this method to set the format on a record by record basis. Set the default format for a 9 digit number and insert somthing similar to the following in the form load event:
Code:
    With Me.Controls("txtPhoneNo").FormatConditions.Add(acExpression, , "(len([txtPhoneNo])=13")
        .Format = "#-##-###-###-####" 'or what ever the international format is
    End With
Additionally you can only create three FormatConditions for any one control (ie. textbox, combobox,)
 

Users who are viewing this thread

Back
Top Bottom