Option Groups and Setting Focus

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

Guest

I have a form that contains an option group with nine options for Position.
Here is what I would like to happen:

When the user selects the ninth option (which is labeled Other), I would
like the focus to move to the Position Name field where they could then key
in the position they are observing that is not in the eight permanent
options. I also want the position that the user keys in to be saved in the
PositionName field.

I have tried several variations of the SetFocus and GoToControl and have
been able to get the focus to move but the position that is keyed in is not
saved.

What am I doing wrong? Thank you in advance.
 
The position name field has to be bound to a field in the record source.
Setting the focus should be no big deal. Just use the After Update event of
the Option Group:

If Me.opgPositioin = 9 Then
Me.txtPositionName.SetFocus
End If
 
Thank you so much that gets me closer.

When I select the ninth option now, it moves me to the PositionName field,
allows me to key a position name and saves it. However, when I enter a
second record and choose the ninth option again, it changes all records that
have the ninth option to the position name I keyed in the second time (i.e.
the first record I keyed in "Sorter" and that was saved, the second record I
keyed "Transportation" as the position name and that was saved but also
changed the first record from "Sorter" to "Transportation").

How do I key a position and have it only saved in one record without
changing the previous positions manually keyed?
 
This sounds like you have the Option Group as a bound control. Is this form
continuous or a datasheet? Is the Position field a lookup field?

I need some detail, please
 
The form is in Single Form view. The option group is what populates the
Position field. That is, Position is the Option Group's control source.

The form is based on a query. In this query, there are two tables and a
query. The main table (tblJobShadow) has the basic information for the job
shadow. Another table (tblPosition) is linked to the Position field in
tblJobShadow and contains the text field that pulls in the PositionName
field. The query (qryNames) is linked to the EmployeeID field in
tblJobShadow and pulls in the Name field for the name of the employee.

In tblPosition, there are two fields: Position and PositionName. Positions
1-8 contain the text equivalent of the numeric value and I based the numeric
values on what the option group assigned as values. Position 9 which is the
"Other" field, I left blank.

Hopefully this makes sense, although it even sounds confusing to me and I
did it. Maybe there is an easier/more efficient way of doing this?
 
Good info, thanks. There is a point, however, on which I am not clear. What
I think I understand is there are two fields Position (tblJobShadow) which
contains the numeric value from the combo, and PositionName (tblJobPosition)
contains the textual description of the field. This is a good approach;
however, if a value of 9 is selected ("Other"), There doesn't seem to be a
way to associate a number in tblJobShadow with the text in tblPosition. The
question is, how do you relate the text value with the value of 9?
 
That is a good question. When I have the value of nine in the table with a
blank description, I have the problem of the description on all records with
a nine value changing when I enter a new description. When I take the nine
value out, the form doesn't work because the Position field is a primary key
in the tblPosition and when I select "Other" on the form, it enters a value
that is not in the table.

I guess I would like it to work like a combo box where you have a list of
constants and can also key in an entry that is not on the list but I like the
fact that the option group is easier for the user to just click on their
selection. Is this possible to do with an option group?
 
Not with an option group, no.

Since the Position descriptions are not limited to a finite list and even if
they were now, you can bet it will change in the future. My suggestion would
be to replace the option group with a combo box.

The row source of the combo should be the Position code (currently the 1
through 8) and the Position description. Make the code the bound column, but
not visilble. Use the Not In List event of the combo to add new descriptions
that are not already in the positions table.

If you need more detail on how to make this work, post back.
 
Back
Top