Hello everyone,
If anyone could help me with this little dilemma, it would be greatly appreciated. Here is the scenario: I would like to generate a field called "PO" (which would be the primary key) that has the following fixed format (L-0000-00000)
ei. M-3055-00001
where cmbReqType = M; txtJobNumber = 3055 & TypeID = (Automated number)
The first letter is chosen by the user (with a combo box named cmbReqType) in the main form (frmPO). The second part is automatticaly added from txtJobNumber from a different form (constant for all POs). Then, I would like the third part to keep track and increment automatically depending on the ReqType that the user will choose.
ei. if the user chooses ReqType "M", the form will automatically generate the following PO: M-3055-00001
if the user chooses ReqType "M" again, the form will automatically generate the following PO: M-3055-00002
if the user chooses ReqType "S", the form will automatically generate the following PO: S-3055-00001 (Restarting the count for the ReqType "S")
if the user rechooses ReqType "M", the form will automatically generate the following PO: M-3055-00003
and so on and so forth.
After, these PO numbers will be the primary key linking various Cost Codes and Vendors.
For better picture of the hierarchy of the database (Roman letters indicate levels):
i) JobNumber (3055)
ii) PO1 (M-3055-00001)
iii) CostCode (3055.00100.0002) - Vendor (ABC Inc.)
iii) CostCode (3055.00100.0002) - Vendor (123 Inc.)
iii) CostCode (3055.00100.0005) - Vendor (ABC Inc.)
ii) PO2 (M-3055-00002)
iii) CostCode (3055.00100.0003) - Vendor (ABC Inc.)
iii) CostCode (3055.00100.0002) - Vendor (123 Inc.)
ii) PO3 (S-3055-00001)
iii) CostCode (3055.00100.0002) - Vendor (ABC Inc.)
iii) CostCode (3055.00200.0002) - Vendor (123 Inc.)
In word, one JobNumber can have many POs (No Duplicates), one PO can have many same or different CostCode, every PO will be linked to a Vendor and finally, one Vendor can be linked to many POs
All the tables & forms are made, and I am ready to create the relationships between the tables just didn't know how to generate my POs in this specifc from. If there is a way, please help me out.
Sincerely,
Kyle