Using a control to apply an input mask to a form field.

H

Hayle

Hi all, I hope I have this in the right place;

I have a table in a database with a simple alpha-numeric text field for
'Location'.

This field will have locations entered in one of 2 possible types: DLS
format and NTS format, each has a separate layout:

Ie:
NTS Location: C-036-I/094-A-11
DLS Location: 100/16-16-016-22W4M/00

I had thought of sing a control (ComboBox) on a form to select the survey
type (DLS/NTS) and then VB to apply an input mask to the field based on the
survey type selected.

Is this the 'best' way to handle this in your opinions, and if so, any
suggestions on how to code VB to handle this correctly?

This is field that will be queried later on for full or partial location
strings.

Any thoughts, oppinions and advice greatly welcomed.
Thanks,
Hayle
 
K

Klatuu

How will you know which type it is during data entry?
Once entered, can it be changed?
 
H

Hayle

Hi Dave,
The person doing the data entry would know if it was DLS or NTS, based ont
he physical location. NTS and DLS are 2 types of land survey, for the
purposes of this DB, locations in Alberta Canada use DLS and Locations in
British Columbia use NTS, so I can't see the system changing in my life time.

I'm not 100% sure I am going about this the right way, but it seems since
each physical well site (What this database is tracking) has only one Survey
Location, it seems that I should have one Field for 'Location' rather then a
DLS and an NTS location for each, when only one or the other would be
populated.

If you have any recomendations, I welcome them openly. Thanks,
Hayle
 
K

Klatuu

The code to set the input mask would not be that difficult. The issue is
knowing which to use. The reason I asked is that if there is something on
your form or in your data at the time the user would be entering the
location, you can set it at that time. I agree it would not be necessary to
carry two location fields in the table. That would make other things in the
application more difficult.

So, if you can discern the type of location, it is as simple as:

If Me.LocationType = "NTS" Then
Me.Location.InputMask =
Else
Me.Location,InputMask -
End If

So the real issue is when to set it. In the above example, I assume a text
box that has the value in it. A better way, I think, would be to use an
option group for the user to select the location type. Or, if the user has
to put in the address before they enter the location and it will always be
the same for a specific provice, you could set the input mask in the After
Update event of the province code control.
 
H

Hayle

Ah! I see what you are saying;

had intended to use a combo box on the form with just a value list; 'Survey
Type:' to select 'NTS' or 'DLS' to establish the condition that would
specify the input mask.
 
K

Klatuu

A combo would work. You still use the After Update event.
It is, of course, a matter of style, but with only two possible and static
options, I think an option group is faster and more obvious to the user.
 
H

Hayle

Thanks Dave, I was just playing around with the look o fit and have to agree
with you, I think we will use the option group instead of a combo box.

I will give that a try and see how badly I can massacre it ;)

Thanks for all your help Dave, I really appreciate it!
Hayle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top