Am trying to create an Access function to quickly create a new, empty 'master record' that contains only the key - then pass that key back to the program for form entry, queries, etc. We like to create the key - right away in order to create other associated rows in other tables - in order to support a lengthy data entry cycle involving master and child records.
The MASTER SQL table has an insert trigger that calculates the next key value and then updates the key of the newly inserted row.
Am thinking about the something like the following Access function invoked as a Button Click:
DoCmd.RunSQL "INSERT INTO MASTER KeyID=0"
Me.NewID = DoCmd.RunSQL "SELECT MAX(KeyID) from MASTER"
DoCmd.RunSQL "INSERT INTO CHILDTABLE KeyID=[Me.NewID] ChildId =0"
Can someone please shed a little light on this ?
How close is this?
Thanks
Jack
The MASTER SQL table has an insert trigger that calculates the next key value and then updates the key of the newly inserted row.
Am thinking about the something like the following Access function invoked as a Button Click:
DoCmd.RunSQL "INSERT INTO MASTER KeyID=0"
Me.NewID = DoCmd.RunSQL "SELECT MAX(KeyID) from MASTER"
DoCmd.RunSQL "INSERT INTO CHILDTABLE KeyID=[Me.NewID] ChildId =0"
Can someone please shed a little light on this ?
How close is this?
Thanks
Jack