answers inline.
Brook said:
Tina,
Thank you for the information this has helped me tremedously! I do have
another question though. Would it be possible to have check box for me to
choose what type of "new" order I have, and then that check box would assign
the Type Code to the proper field in my table? If so, do you have any
suggestion on how I could do this,
to use checkboxes to select an OrderType, i would probably create an unbound
OptionGroup control on the data entry form, using the Controls Wizard, to
show the OrderType choices. then i would use code to set the value of the
OrderType field, based on which box was checked. usually, you would also
need to add code to the form's Current event, to show the correct checkbox
selection in existing records. unless you're comfortable with using
OptionGroup controls and VBA code, though, you'd probably find it a lot
easier to use a combo box. to do that:
create the combo box on your data entry form, i'll call it cboOrderType.
make sure the form's RecordSource is based on tblOrders. set the combobox's
ControlSource to OrderType. set the following properties of the combobox as:
RowSourceType: Value List
RowSource: Custom; Stock; Sample
ColumnCount: 1
ColumnHeads: No
BoundColumn: 1
LimitToList: Yes
and how it would know to add an increment
to the proper order type?
you would need to add the incremental number programmatically, as i said
before. if your database will have multiple concurrent data entry users, i
would probably *not* generate and assign the number until the record is
about to be saved to the table. if, however, you will *never* have more than
one user entering records in the table at the same time, you can generate
the incremental number and assign it to the record on the AfterUpdate event
of the control that is bound to the OrderType field.
in either scenario, one fairly easy way to generate the sequential number in
code is
Me!OrderNum = Nz(DMax("OrderNum", "tblOrders", "OrderType = '" &
Me!OrderType & "'"), 0) + 1
(the code would be all on one line.) in the example above, OrderNum is the
name of the field in tblOrders, where the sequential number is stored.
*remember*, though: when you have multiple concurrent users, the TIMING of
when the number is generated and saved can be very tricky - and can result
in non-sequential assignment and/or gaps in the sequence.
hth