H
Holly
Hi guys. I need some advice. I've been wasting a lot of time trying
different approaches, but I thought I'd ask some experts for opinions.
I have a Form which access one table.
The table is not really normalized, it has a Document number as a key,
broken down into 2 columns Group and Instruction. There can also be
multiple Item numbers because there needs to be a Revision history with
a 2 digit revision number, so I could have:
Document Group Inst Revision #
123.01-001 123.01 001 00
The revision numbers can increment by 1 for each change to the
Document. They have one big form to maintain the table. The users can
either Add, Change or just browse through
the form. The form displays some other detail info that is also listed
in the main table (like Title, Training (Y/N), Status, etc).
So I added a Group and Inst cascading combo box. The cbo1 (group) box
does a RowSource query on the Enter event, "Select Distinct Group from
tblX;" Then the cbo2 (Instruction #) box looks up a RowSource on the
enter event, "select distinct Instnbr from tblX where
(((Group)=[cbo1])) Order By Instnbr;"
I have a NotinList on cbo2, so the user can enter new Instruction
Numbers (the groups will stay the same so I don't need one for cbo1).
Then I also have an AfterUpdate on cbo2 to do a FindFirst to retrieve
the values the user picks from combo1 & combo2, and place a bookmark
there. Everything seems to work ok, except when I need to add a new
record.
The problem is the Revision number. The program is adding one, to
increment the revision number automatically when the user clicks the
Add button and goes to select the combo boxes for that Group and
Instruction number. The table is sorted by Group asc, Inst asc and
Revision# descending. The find first gets the latest Revision number,
which is all the user wants to see in the form. But if they need to do
an Add for that given cbo1 & cbo2 they searched for, to add a new
revision number, that needs to auto increment by 1. I can't
autoincrement the field in the table because it is unique to each group
& instruction (or document).
I tried doing an AddNew in the AfterUpdate of combo2, by setting a flag
(I'm a mainframe programmer, so I know this is bad) when the Click is
done on the Add button. If that value is true, it adds 1 to the
existing revision number. However, the form updates before the user
has had time to enter the new fields, which have been filled in with
the bookmarked instance of the group and Instruction number. The
revision number is saved over the existing record because of the darn
bookmark.
Can anyone suggest how I can add a new record after an AfterUpdate,
bookmark for a multi combo box?
Thank you!
different approaches, but I thought I'd ask some experts for opinions.
I have a Form which access one table.
The table is not really normalized, it has a Document number as a key,
broken down into 2 columns Group and Instruction. There can also be
multiple Item numbers because there needs to be a Revision history with
a 2 digit revision number, so I could have:
Document Group Inst Revision #
123.01-001 123.01 001 00
The revision numbers can increment by 1 for each change to the
Document. They have one big form to maintain the table. The users can
either Add, Change or just browse through
the form. The form displays some other detail info that is also listed
in the main table (like Title, Training (Y/N), Status, etc).
So I added a Group and Inst cascading combo box. The cbo1 (group) box
does a RowSource query on the Enter event, "Select Distinct Group from
tblX;" Then the cbo2 (Instruction #) box looks up a RowSource on the
enter event, "select distinct Instnbr from tblX where
(((Group)=[cbo1])) Order By Instnbr;"
I have a NotinList on cbo2, so the user can enter new Instruction
Numbers (the groups will stay the same so I don't need one for cbo1).
Then I also have an AfterUpdate on cbo2 to do a FindFirst to retrieve
the values the user picks from combo1 & combo2, and place a bookmark
there. Everything seems to work ok, except when I need to add a new
record.
The problem is the Revision number. The program is adding one, to
increment the revision number automatically when the user clicks the
Add button and goes to select the combo boxes for that Group and
Instruction number. The table is sorted by Group asc, Inst asc and
Revision# descending. The find first gets the latest Revision number,
which is all the user wants to see in the form. But if they need to do
an Add for that given cbo1 & cbo2 they searched for, to add a new
revision number, that needs to auto increment by 1. I can't
autoincrement the field in the table because it is unique to each group
& instruction (or document).
I tried doing an AddNew in the AfterUpdate of combo2, by setting a flag
(I'm a mainframe programmer, so I know this is bad) when the Click is
done on the Add button. If that value is true, it adds 1 to the
existing revision number. However, the form updates before the user
has had time to enter the new fields, which have been filled in with
the bookmarked instance of the group and Instruction number. The
revision number is saved over the existing record because of the darn
bookmark.
Can anyone suggest how I can add a new record after an AfterUpdate,
bookmark for a multi combo box?
Thank you!