HOW WRITE FORM DATA TO UNBOUND TABLE

S

SteveL

I have a form which is not bound to a table. The form
contains several calculated fields. I want to write code
to make the calculated values of each field write over to
a specific unbound table at the click of a button and
don't know where to begin.

Can anyone help? Even one example of a field to be
written to an unbound table field would be helpful.

Thanks.
 
R

Rick Brandt

SteveL said:
I have a form which is not bound to a table. The form
contains several calculated fields. I want to write code
to make the calculated values of each field write over to
a specific unbound table at the click of a button and
don't know where to begin.

Can anyone help? Even one example of a field to be
written to an unbound table field would be helpful.

First off forms and reports can be bound or unbound. There is no such thing as
an unbound table.

Simple example of inserting fields from an unbound form into a table using code
running in the form's own module...

CurrentDB.EXECUTE "INSERT INTO SomeTable (NumField, TextField, DateField) VALUES
(" & Me!NumControlName & ", '" & Me!TextControlName & "', #" &
Me!DateControlName & "#)",dbFailOnError

If I wrote the above correctly it would be translated to look something like
this when run...

INSERT INTO SomeTable (NumField, TextField, DateField) VALUES (1234, 'A String',
#12/2/2003#)
 
G

Guest

-----Original Message-----


First off forms and reports can be bound or unbound. There is no such thing as
an unbound table.

Simple example of inserting fields from an unbound form into a table using code
running in the form's own module...

CurrentDB.EXECUTE "INSERT INTO SomeTable (NumField, TextField, DateField) VALUES
(" & Me!NumControlName & ", '" & Me!TextControlName & "', #" &
Me!DateControlName & "#)",dbFailOnError

If I wrote the above correctly it would be translated to look something like
this when run...

INSERT INTO SomeTable (NumField, TextField, DateField) VALUES (1234, 'A String',
#12/2/2003#)


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
Rick,

Thank you very much for the quick reply and help
regarding the following:

If I understand you correctly, my code would read:

CurrentDB.Execute "INSERT INTO tblCalcValues (txtCutCalc)
VALUES (" & Me!txtCutCalc & "),dbFailOnError

Is this syntax correct? The table name is tblCalcValues
and the field on the form is txtCutCalc. All fields on
the form are numeric values.

Also, I assume I need a line like the above (or whatever
you correct it to read) for each field to be written over
to the table, correct?

I hate to sound stupid but this one really has me
stumped. That's so much for your help.

--Steve
 
L

Larry Daugherty

You'd do better to post this question into Forms or FormsCoding newsgroups.
Table design won't affect the outcome.

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