Select data from one table and save resulting record to another ta

G

Guest

Hi,
I have some experience with SQL Server but not with Access and I find the
two to feel very different so I apologize for my ignorance.
I have a table called Pastry and I made a form with a bunch of drop down
lists that are populated by queries from that table. I want the user to go
through and make his or her selections, and then to save those selections as
a record in another table. Seems pretty simple but I can't make it work in
access. I have an Access bible and I have searched extensively online but I
cannot seem to find the answer to this question: How do I select options in a
form from one table and save them to another?
Thanks,
Tara
 
T

tina

is your form bound to that "other" table? and is each combo box control on
the form bound to a field in that "other" table?

hth
 
G

Guest

Use an insert SQL

Docmd.RunSql "INSERT INTO TableName ( DateFieldName, StringFieldNAme,
NumberFieldName) VALUES (#" & DateParameter & "#,'" & StringParameter & "' ,
" & NumberParameter &")"

If you want to add a values from fields in the form, change the parameter to
Me.FieldName
Note the different between date (need #) string (need ') and number (need
nothing)
 
G

Guest

Thank you- this is very helpful. Can you give me one more bit of direction? I
understand the SQL, but where does it go? I don't understand enough about the
Access UI to know where the SQL goes to make the save happen.
Thanks,
Tara
 
G

Guest

You can use a button on the form, after all the selections are made and the
user click on the button you can run this code to save the record in the
table, use the OnClick event of the button to run the SQL
 
T

tina

to bind a form to a table (or a query), open the form in design view and, in
the Properties box, click on the RecordSource property. enter the name of
the table or query you want to bind the form to, and now it's bound.

to bind controls on a form to fields in the form's RecordSource, open the
form in design view and click on a control. in the Properties box, click on
the ControlSource property. enter the name of the field, from the form's
RecordSource, that you want to bind the control to, and now it's bound.
repeat for each control that you want to bind to a field in the
RecordSource.

if you bind your form/controls to a table(or query)/fields, then you are
essentially entering data directly into the table, via the form interface,
with no need for an Append query to write the data to the table.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top