save data from main form and subform (1 Viewer)

basilyos

Registered User.
Local time
Yesterday, 21:24
Joined
Jan 13, 2014
Messages
256
hello am trying to create a sales app for my business i want to save data from the main form to a specific table and the data from the subform to another table and for each row in the subform i want to add the invoice id that is existed in themain form

here a copy of my database the form am asking with named "frm_Invoice_New"

i will really appreciate your help
 

Attachments

  • Print Pro.accdb
    1.6 MB · Views: 7

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:24
Joined
May 7, 2009
Messages
19,305
you should use Bound form and there is no need for "temp" invoice detail.
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
14,761
Just link them with the Link Master/Child fields in properties in the subform control.
 

basilyos

Registered User.
Local time
Yesterday, 21:24
Joined
Jan 13, 2014
Messages
256
what can i do to let the user save the data in both tables just by pressing save and choosing yes and if choose to close or pressing no after pressing save the data in both tables will not be saved
and also i want to prevent the invoice id to increase if the user choose not to save
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
14,761
So the InvoiceID would be your own number and not an autonumber. You would set that in the form BeforeInsert event I believe.
If you want to keep it unbound then use Insert SQL statements or recordsets.

I personally have never used unbound forms, so I am out.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:24
Joined
Feb 19, 2002
Messages
44,010
In a relational database, the parent record must exist before the child record can be saved so that is the way bound forms are implemented. The record in the main form is saved automatically when focus moves from the main form to the subform. Then each subform record is saved when you move to the next line to add a new subform record.

If you are not going to use bound forms and the "Access way", you are far better off using a different development platform that more closely emulates your desired methods.
 

basilyos

Registered User.
Local time
Yesterday, 21:24
Joined
Jan 13, 2014
Messages
256
In a relational database, the parent record must exist before the child record can be saved so that is the way bound forms are implemented. The record in the main form is saved automatically when focus moves from the main form to the subform. Then each subform record is saved when you move to the next line to add a new subform record.

If you are not going to use bound forms and the "Access way", you are far better off using a different development platform that more closely emulates your desired methods.
big thanks to your reply and of course i will use it as it's desired to be used
 

Users who are viewing this thread

Top Bottom