If you have parent/child forms:
tbl_TTA as master
and tbl_MAC as child.
tbl_MAC SHOULD have its own autonum for a MacID
tbl_MAC will have MacID(as autonumber, always good to have)
and the tbl_MAC.WO (as long, filled automatically via parent/child form)
when the new tbl_MAC rec is created, it can generate the new ITEM# via code:
count the # records for THAT tbl_TTA.WO
then either start from 1 (if null) or add +1 if this ID exists:
Code:
btnAddNewOrder_click()
dim vWO, vRet, vNum, vItem
vWO = forms!ParentForm!WO 'get the parent work order#
vRet = Dcount("*","tbl_MAC","[WO]=" & vWO) 'count the # of records in tbl_Mac with this WO
DoCmd.GoToRecord , , acNewRec
if vRet=0 then
vItem = vWO & "-01"
else
vNum = vRet + 1
vItem = vWO & "-" & format(vNum,"00")
endif
txtItemNum = vItem 'fill in new order# in the textbox
end sub