Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access/SQL - Setup a new record

Status
Not open for further replies.

JackR

IS-IT--Management
Jun 7, 2001
10
0
0
US
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



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top