B
BruceM
I have a Contacts database that includes a table for the basic stuff
(FirstName, LastName, Street, City, etc.) and a main form based on that
table, and a linked table (and subform fsubPhone based on that table) for
phone numbers, since there can be several. I contrived to make the phone
number subform look and act like a text box. When there is zero or one
phone numbers for the contact, there is no scroll bar on the subform; for
two or more phone numbers there is a scroll bar. I set this in the
subform's current event (the subform itself, not the subform control).
A further note is that when there are two or more phone numbers, the
subform's Allow Additions property is set to No so that there isn't a blank
record when scrolling, which I already know will confuse people who are
determined to be confused.
Here are a few issues, and the ways I found to deal with them:
1) I found I couldn't tab out of the subform control, but I could click out
of it. To solve the tabbing problem I added a tiny text box on the subform,
with transparent border and back color. Its Got Focus event is to set the
focus to the next control on the main form. I think that's sort of standard
procedure.
2) Since there is no scroll bar with one phone number, and Allow Additions
set to False with two or more phone numbers, I added a command button (a
label, acutally) to the main form with the following as its Click event:
blnPhone = True
Me.fsubPhone.Form.AllowAdditions = True
Me.fsubPhone.SetFocus
(blnPhone is a Public Boolean I defined in a standard module)
The subform's Enter event is:
If blnPhone = True Then
DoCmd.GoToRecord , , acNewRec
End If
This works fine as long as the subform does not have the focus, but if the
cursor is in the subform it doesn't work. The cursor just stays there, and
I need to click a main form control (i.e. leave the subform) before the
Click event will work.
What I wonder here is first, whether I have made this more difficult than it
needs to be. If so, what can I do to improve this thing? Training the
users is not really an option. I will do that, but many people will use the
database only occasionally, so I can't expect them to remember the finer
points (even if they were all willing to try, which some are not, but that's
a topic for another forum). Second, why can't I get the Click event to work
with the cursor in the subform's text box? Finally, it seems I have the
choice of running events in one of several different places. For instance,
I can set Allow Addition to true when needed to add a number as I have done,
or I can do it in the subform's Got Focus event (or some other subform
event, no doubt). Is one preferable to another as a general rule? For what
its worth, this database will never have more than a few hundred records in
any one table.
(FirstName, LastName, Street, City, etc.) and a main form based on that
table, and a linked table (and subform fsubPhone based on that table) for
phone numbers, since there can be several. I contrived to make the phone
number subform look and act like a text box. When there is zero or one
phone numbers for the contact, there is no scroll bar on the subform; for
two or more phone numbers there is a scroll bar. I set this in the
subform's current event (the subform itself, not the subform control).
A further note is that when there are two or more phone numbers, the
subform's Allow Additions property is set to No so that there isn't a blank
record when scrolling, which I already know will confuse people who are
determined to be confused.
Here are a few issues, and the ways I found to deal with them:
1) I found I couldn't tab out of the subform control, but I could click out
of it. To solve the tabbing problem I added a tiny text box on the subform,
with transparent border and back color. Its Got Focus event is to set the
focus to the next control on the main form. I think that's sort of standard
procedure.
2) Since there is no scroll bar with one phone number, and Allow Additions
set to False with two or more phone numbers, I added a command button (a
label, acutally) to the main form with the following as its Click event:
blnPhone = True
Me.fsubPhone.Form.AllowAdditions = True
Me.fsubPhone.SetFocus
(blnPhone is a Public Boolean I defined in a standard module)
The subform's Enter event is:
If blnPhone = True Then
DoCmd.GoToRecord , , acNewRec
End If
This works fine as long as the subform does not have the focus, but if the
cursor is in the subform it doesn't work. The cursor just stays there, and
I need to click a main form control (i.e. leave the subform) before the
Click event will work.
What I wonder here is first, whether I have made this more difficult than it
needs to be. If so, what can I do to improve this thing? Training the
users is not really an option. I will do that, but many people will use the
database only occasionally, so I can't expect them to remember the finer
points (even if they were all willing to try, which some are not, but that's
a topic for another forum). Second, why can't I get the Click event to work
with the cursor in the subform's text box? Finally, it seems I have the
choice of running events in one of several different places. For instance,
I can set Allow Addition to true when needed to add a number as I have done,
or I can do it in the subform's Got Focus event (or some other subform
event, no doubt). Is one preferable to another as a general rule? For what
its worth, this database will never have more than a few hundred records in
any one table.