Navigation Form New Record (1 Viewer)

WES9659

Registered User.
Local time
Today, 15:43
Joined
Dec 17, 2012
Messages
17
Does anyone know if it is possible to place a Button on First Tab of a multi tabbed Navigation form in Access 2010 that can create a new record in each of the tabs simultaneously?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:43
Joined
Feb 19, 2002
Messages
42,976
You would have to write code that runs an append query for each of the subform recordsets. I don't advise this. It is poor technique to pre-create records that may never be used.
 

WES9659

Registered User.
Local time
Today, 15:43
Joined
Dec 17, 2012
Messages
17
Thanks Pat, How would you create it if you did decide to go that route?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:43
Joined
Feb 19, 2002
Messages
42,976
Sorry. I post a lot of code here and some of it I create for the poster on the fly rather than pull out of my code base but I draw the line at writing code for someone else for free that I wouldn't write for myself. Besides, I already told you how to do it.

You need as many insert queries as you have tables to insert data into. You need to pass them arguments that include a value for the foreign key so the new records will link to the correct parent record. Then you need the code to run the queries. use the DoCmd.OpenSQL method to run each query. If you have 5 insert queries, you will have 5 lines of code. I think you can handle it. At worst you have 10 lines of code if you create the SQL strings separately.
 

WES9659

Registered User.
Local time
Today, 15:43
Joined
Dec 17, 2012
Messages
17
Thank you for all your time in explaining this to me :)
 

Users who are viewing this thread

Top Bottom