NotInList w/ Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My main form has three places where people's names go. All three use combo
boxes that utilize a Select query (written into the properties window) to
pull information from a contacts table. The query pulls first names, last
names, middle initials and contactID numbers. It displays the full names
(first mi Last), but stores the ID. When the "NotInList" event fires, and
the user agrees to "add" a name, a form "PopupContacts" opens in dialogue
form mode for data entry.

In the "PopupContacts" form there are three events in the code. Two are for
"ok" and "cancel" buttons on the "PopupContacts" form. The third is this:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.[First Name] = Me.OpenArgs
End If
End Sub

The problem is as much design as it is coding, I suppose, but I like the way
things are except: Someone will type in a first and last name (and possible
middle initial) and when they go to add the new person to the contacts, all
that name info will be deposited into the firstname field. Is there a way
for me to code it so it will recognize the spaces and send each name to the
appropriate control on the popupcontacts form (eg if there are three distinct
character groups, but the first one in the firstname, the second in the MI
and the third in the lastname; if there is only two, first goes to firstname
and second goes to lastname)? I realize this won't always work properly, but
it would be nice if it worked with a "standard" first name, middle initial,
last name situation, or maybe even just a first name last name situation.

Thanks (again),
CW
 
Instead of having one text box, use three clearly labeled textboxes. This
encourages the user to enter the data correctly. There's only so much you
can do in terms of error-proofing your program. Even if you parsed the data
by looking for a space or a comma, how would you know that the user put the
first name before the last name and not vice versa? Just a suggestion.

FirstPart = Mid([Field],1,Instr([Field]," ")-1)
SecondPart = Mid([Field],Instr([Field]," ")+1)

Cheese_whiz said:
My main form has three places where people's names go. All three use combo
boxes that utilize a Select query (written into the properties window) to
pull information from a contacts table. The query pulls first names, last
names, middle initials and contactID numbers. It displays the full names
(first mi Last), but stores the ID. When the "NotInList" event fires, and
the user agrees to "add" a name, a form "PopupContacts" opens in dialogue
form mode for data entry.

In the "PopupContacts" form there are three events in the code. Two are for
"ok" and "cancel" buttons on the "PopupContacts" form. The third is this:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.[First Name] = Me.OpenArgs
End If
End Sub

The problem is as much design as it is coding, I suppose, but I like the way
things are except: Someone will type in a first and last name (and possible
middle initial) and when they go to add the new person to the contacts, all
that name info will be deposited into the firstname field. Is there a way
for me to code it so it will recognize the spaces and send each name to the
appropriate control on the popupcontacts form (eg if there are three distinct
character groups, but the first one in the firstname, the second in the MI
and the third in the lastname; if there is only two, first goes to firstname
and second goes to lastname)? I realize this won't always work properly, but
it would be nice if it worked with a "standard" first name, middle initial,
last name situation, or maybe even just a first name last name situation.

Thanks (again),
CW
 
Thanks for the reply,

I'll have to think a little more about it. I know there's some benefits to
having seperate combo boxes for each name field (one for first, one for last,
one for middle). I just haven't got a firm picture of how that would
look/work yet in my form. All I know is that my form is pretty packed as it
is, and adding what amounts to several more controls isn't something I can do
very easily without really cluttering things up. I guess I could consider
adding a tab...

If anyone has a good example of how to use multiple combo boxes with
notInList event handling I'd be interested in seeing it.... I need to be
able to add a new record and, if necessary, add a new contact all at the same
time seemlessly, which is why I got into the "notInList" thing to begin with.

As for the "how will you know if first name was entered first", well,
technically I won't. But the current combo box lists autoexpand when you
begin to type, so hopefully that will show most people the proper way to type
in the name. Like you said, you can't fully idiot proof anything.

The other consideration in doing it the way it's set up now is that 2 of the
3 current controls I use for adding people's names to this form include a
relatively small subset of the contacts that will ultimately be in the
database. For those two choices, it's a lot easier to pick from among a
small number of full (and fairly stable) names using just one combo box than
it would be to type (or choose) individual names in three seperate controls
(per person). Really, one of the two would probably be better set up to
autofill based on the current user, since that's what the field is suppose to
indicate: who created the record.

Ahhhh, decisions decisions...

Thanks again for the info. I'm amazed at how much I've learned and how far
this project has come in a relatively short time. It never would have made
it this far without the great contributors here.

CW

kingston via AccessMonster.com said:
Instead of having one text box, use three clearly labeled textboxes. This
encourages the user to enter the data correctly. There's only so much you
can do in terms of error-proofing your program. Even if you parsed the data
by looking for a space or a comma, how would you know that the user put the
first name before the last name and not vice versa? Just a suggestion.

FirstPart = Mid([Field],1,Instr([Field]," ")-1)
SecondPart = Mid([Field],Instr([Field]," ")+1)

Cheese_whiz said:
My main form has three places where people's names go. All three use combo
boxes that utilize a Select query (written into the properties window) to
pull information from a contacts table. The query pulls first names, last
names, middle initials and contactID numbers. It displays the full names
(first mi Last), but stores the ID. When the "NotInList" event fires, and
the user agrees to "add" a name, a form "PopupContacts" opens in dialogue
form mode for data entry.

In the "PopupContacts" form there are three events in the code. Two are for
"ok" and "cancel" buttons on the "PopupContacts" form. The third is this:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.[First Name] = Me.OpenArgs
End If
End Sub

The problem is as much design as it is coding, I suppose, but I like the way
things are except: Someone will type in a first and last name (and possible
middle initial) and when they go to add the new person to the contacts, all
that name info will be deposited into the firstname field. Is there a way
for me to code it so it will recognize the spaces and send each name to the
appropriate control on the popupcontacts form (eg if there are three distinct
character groups, but the first one in the firstname, the second in the MI
and the third in the lastname; if there is only two, first goes to firstname
and second goes to lastname)? I realize this won't always work properly, but
it would be nice if it worked with a "standard" first name, middle initial,
last name situation, or maybe even just a first name last name situation.

Thanks (again),
CW
 

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

Back
Top