B
Bruce
I have a form for Production Procedures, and a subform for
the parts that are covered by the procedure. The subform
works by selecting a part number from a combo box. The
Row Source for the combo box is a table of all parts
(actually, a query based on the table). The combo box
does auto-complete or whatever exactly they call it in
Access, so that typing "8" jumps to the first part number
starting with "8", "89" jumpts to the first part number
starting with "89", etc.
Sometimes the user needs to add a part, in which case
there should be a command button to allow this. At other
times the user starts to enter a part number in the combo
box, and discovers it is not among those listed. In that
case there needs to be something inherent to the combo box
that announces there is no such part number, and provides
a way of adding one.
One suggestion I have received is to have the combo box
Not In List event generate a message box directing the
user to double click the combo box. The Double Click
event of the combo box opens the form for entering a new
part number, clears whatever was previously entered in the
combo box (i.e. the nonexistent part number), and
requeries the combo box so that the new Part Number shows
up right away.
So I get the message box to generate the message, and the
combo box's double click event is:
Me![cboPartNumber] = Null
DoCmd.OpenForm "FrmPart", , , , , acDialog
Me![cboPartNumber].Requery
I also tried it with "" instead of Null. In both case I
received notification of error 3162, and this gem: "You
tried to assign the null value to a variable that is not a
variant data type." Eliminating the part about Null leads
to an error at Requery, which I apparently can't do
without saving the record, although it works from the
command button.
Here's what I would like to do: The code works fine when
I attach it to a command button for opening the form to
add a part number, except that the code doesn't have that
line about Null or "". What I would really like is to use
the same command button from the Not In List event. I had
thought that the message box could direct the user to the
command button, or even open a form directly. The idea is
that entering a new part number should be accomplished in
the same way at all times.
To sum up, when a part is not on the combo box list in the
subform, I would like notification of that, and an easy
and consistent way of adding a new part number using the
part number form.
the parts that are covered by the procedure. The subform
works by selecting a part number from a combo box. The
Row Source for the combo box is a table of all parts
(actually, a query based on the table). The combo box
does auto-complete or whatever exactly they call it in
Access, so that typing "8" jumps to the first part number
starting with "8", "89" jumpts to the first part number
starting with "89", etc.
Sometimes the user needs to add a part, in which case
there should be a command button to allow this. At other
times the user starts to enter a part number in the combo
box, and discovers it is not among those listed. In that
case there needs to be something inherent to the combo box
that announces there is no such part number, and provides
a way of adding one.
One suggestion I have received is to have the combo box
Not In List event generate a message box directing the
user to double click the combo box. The Double Click
event of the combo box opens the form for entering a new
part number, clears whatever was previously entered in the
combo box (i.e. the nonexistent part number), and
requeries the combo box so that the new Part Number shows
up right away.
So I get the message box to generate the message, and the
combo box's double click event is:
Me![cboPartNumber] = Null
DoCmd.OpenForm "FrmPart", , , , , acDialog
Me![cboPartNumber].Requery
I also tried it with "" instead of Null. In both case I
received notification of error 3162, and this gem: "You
tried to assign the null value to a variable that is not a
variant data type." Eliminating the part about Null leads
to an error at Requery, which I apparently can't do
without saving the record, although it works from the
command button.
Here's what I would like to do: The code works fine when
I attach it to a command button for opening the form to
add a part number, except that the code doesn't have that
line about Null or "". What I would really like is to use
the same command button from the Not In List event. I had
thought that the message box could direct the user to the
command button, or even open a form directly. The idea is
that entering a new part number should be accomplished in
the same way at all times.
To sum up, when a part is not on the combo box list in the
subform, I would like notification of that, and an easy
and consistent way of adding a new part number using the
part number form.