I can create a customized Input Mask, however there are two possible structures that the data may take. I think that this should be doable by the use of two fields, if it can be done with one field it would be preferable for searching options. If I have to use two fields there would only be one or the other used for each record so I would prefer to have the unused field inhibited. Either way the code work is beyond my present ability, any assistance would be appreciated.
Why not use one field in your table to store the data. Let's say your form is called fmYourform and is bound to a table tblYourTable. The field that stores the information is called YourField.
On your form, place a textbox bound to YourField (txtYourField) and make it invisible. Add two unbound textboxes (txtFirstFormat and txtSecondFormat). Set the input mask for each textbox to the appropriate structure that you want.
Then, in the after_update event of each text box use code to set the value of txtYourField to be the same as the value you just types in.
eg. for txtFirstFormat
Code:
Private Sub txtFirstFormat_AfterUpdate()
if Me.txtFirstFormat & "" <> "" then Me.txtYourField = Me.txtFirstFormat
End sub
In the on_current event of your form, clear the values of the two unbound textboxes so that they are cleared for each record that you add.
If you want to use an option to make only one unbound textbox visible at a time, then use the after update event of the option or toggle button to make one textbox visible, and the other invisible, or vice versa depending on the value of the option/toggle button.
To make txtFirstFormat visible you would use something like:
Code:
If Me.YourOption = 0 then
Me.txtFirstFormat.Visible = True
Me.txtSecondFormat.Visible = False
Else
Me.txtFirstFormat.Visible = False
Me.txtSecondFormat.Visible = True
End if
in the after_update event of your option or toggle button.
You might need to set the default visibility of the two boxes so that only one appears when you first open the form.