Re: Creating an Orders Form with multiple order types
- From: "Brook" <Brook@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Mar 2005 13:13:02 -0800
JP,
Thank you for the information, and I understand that I cannot use the
autonumber function, but I need sequential number for each type of order. I
have the ComboBox for the OrderTypes. I am going to have to do some research
the DMAX function. If you know if any samples that I can look at please let
me know.
Also you mention that I need to make sure there is no "Null" value... what
if I set my initial value to "0" or "1", then there wouldn't /couldn't be a
"null" value. Correct?
Thanks,
Brook
"JP" wrote:
> If you really want the order numbers to be separate by order type (i.e., the
> same order number can appear across order types but not within order types)
> then you cannot use an autonumber field.
>
> In that case, put an order type combo box or option group on your form. In
> the Before Update event for the form, put in code that does a DMAX on the
> order number field for that order type and then increment the result by 1 to
> make it the order number of the order being entered.
>
> You of course have to test to make sure that the user selected the order
> type before you can run the DMAX. You also have to have some code to test
> for a null result from the DMAX, which is what you'll get when entering the
> very first record for each order type. And, you'll have to have some code
> to make sure that you only try to set the order number on new records (set a
> flag if me.newrecord is true in the On Current Event). The order number
> field could not be the primary key because it is not unique (presumably the
> combination of the order type and order number could be the primary key).
>
> A lot of work.
>
> Or, you can simply use an autonumber field and make the order number unique
> across all order types. I would argue that's a better approach because this
> way you can never have any confusion caused by two different orders with the
> same order number (even if they are different order types).
>
>
> "Brook" <Brook@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:BC2A9FCE-885B-4314-98E2-4D0DE0E720EB@xxxxxxxxxxxxxxxx
> > Good day,
> >
> > What I have is this: tblorders (which houses all my orders - Custom
> (CST),
> > Stock (STK), and Sample (SPL). within the tblorders I have an "orderstype"
> > and "ordernumber".
> >
> > What I am trying to do is this: create either a Combo box or an option
> > group on my form, so that when I choose the appropriate order type, that
> type
> > code is saved in the "ordertype" field in my table, and the "ordernumber"
> for
> > that type is increased / incremented by 1.
> >
> > Any Ideas / suggestions?
> >
> > thanks,
> >
> > Brook
>
>
>
.
- Follow-Ups:
- References:
- Prev by Date: DateAdd +weeks dropping a few days
- Next by Date: Re: Adding an Alpha Search Button on a form
- Previous by thread: Re: Creating an Orders Form with multiple order types
- Next by thread: Re: Creating an Orders Form with multiple order types
- Index(es):
Relevant Pages
|