J
Jefferey Simmons
Hi,
I have a table called Orders that is used to log orders. The order can be
either sale_typeA or sale_typeB. So one field in the table is called
Sale_type and is used to specify the type of sale; either A or B. There is
a second field, Number, that gives that order a number. Both fields are
primary keys (multiple-field primary key), indexed -duplicates OK. The
number in the second field is to be automatically generated after the
sale_type has been updated (AfterUpdate). Now this is when I get lost. I
need to make the numbering of sale_typeA independent of saletypeB. So what
I want it to do is query the table to find the Max entry of Number where
sale_type=A or sale_type=B, add 1 to that value and insert it into Number of
the current field. So in a SQL statement it might look something like this:
SELECT Max(Number) as Max
FROM Orders
WHERE sale_type='A'
Then somehow that the value of Max, add 1 to it and update Number of the new
and current record in Orders with that value.
I can't find a way to do this using update or SQL statements and the only
other thing I have come across is record sets. Does anyone know how I would
declare something like this in VB and get it to do what I need it to do?
Please help.
TIA,
Jefferey
I have a table called Orders that is used to log orders. The order can be
either sale_typeA or sale_typeB. So one field in the table is called
Sale_type and is used to specify the type of sale; either A or B. There is
a second field, Number, that gives that order a number. Both fields are
primary keys (multiple-field primary key), indexed -duplicates OK. The
number in the second field is to be automatically generated after the
sale_type has been updated (AfterUpdate). Now this is when I get lost. I
need to make the numbering of sale_typeA independent of saletypeB. So what
I want it to do is query the table to find the Max entry of Number where
sale_type=A or sale_type=B, add 1 to that value and insert it into Number of
the current field. So in a SQL statement it might look something like this:
SELECT Max(Number) as Max
FROM Orders
WHERE sale_type='A'
Then somehow that the value of Max, add 1 to it and update Number of the new
and current record in Orders with that value.
I can't find a way to do this using update or SQL statements and the only
other thing I have come across is record sets. Does anyone know how I would
declare something like this in VB and get it to do what I need it to do?
Please help.
TIA,
Jefferey