Saving information from form to a different table? (1 Viewer)

Jaylfc88

New member
Local time
Today, 23:28
Joined
Nov 17, 2012
Messages
4
Hi everyone I have created a form and a subform within it, I have managed to populate all the dropdown boxes from the tables I need. but I need to save all the information in putted to a table called bookingstbl and I do not know where to begin?

Regards

James
 

Isskint

Slowly Developing
Local time
Today, 23:28
Joined
Apr 25, 2012
Messages
1,302
Several methods open to you Jaylfc88. By far the easiest would be to have the form (and subform perhaps) bound to a table. That way the adding is done automatically.
Now if there is a reason you do not want to do this then you can either use SQL to add the new record(s) or an append query (essentially the same thing, however the append query is 'easier' to do if you are not good with VBA).
Have a look at the attached for some ideas
 

Attachments

  • db1.4.mdb
    168 KB · Views: 119

Jaylfc88

New member
Local time
Today, 23:28
Joined
Nov 17, 2012
Messages
4
Hi Isskint

Thank you so much for the response its much appreciated! I just need to be able to do it as part of my coursework so if you could elaborate on how to do it any way you would be a life saver! btw I have some knowledge of VBA and some SQL but both are limited :(
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:28
Joined
Feb 19, 2002
Messages
43,477
Change the Recordsource of the form to select the columns you need from a table or query. Then bind each control to a column from that RecordSource by changing their ControlSources. Normally, you choose the Recordsource first so that when you add controls to the form, Access will automatically bind them for you.
 

Isskint

Slowly Developing
Local time
Today, 23:28
Joined
Apr 25, 2012
Messages
1,302
if you could elaborate on how to do it any way you would be a life saver! btw I have some knowledge of VBA and some SQL but both are limited :(

Thats what the attached is for;). It demonstrates 2 methods (VBA and SQL) of doing what you want to do.
 

Jaylfc88

New member
Local time
Today, 23:28
Joined
Nov 17, 2012
Messages
4
Private Sub Save_and_Close_Form_Click()
RunCommand acCmdSaveRecord
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [Pupilstudiestbl] SELECT * FROM [pupilstudiesfrm]
RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End Sub


I have tried to use this to save my unbound fields to a table but getting an error can anyone help? :(
 

Users who are viewing this thread

Top Bottom