Using unbound forms to update tables

M

mchicke

I am attempting to similate a already in-use generic outlook form in access.
I would like to use 1 unbound form to save the data to several different
tables. How should I go about this?
 
O

Ofer Cohen

Is it to update existing records or insert new records to the tables?

For new record you can use append SQL, and for update existing record use
update SQL.
I'll be happy to assist of you can provide more details on what you are
trying to do.
 
M

mchicke

I should be more clear. I want to insert new records. The date field will
be used in all tables, and there is a 'shift' field that will also be used in
all tables. So there will be three records with the same date. Is this
possible, or is it too complex?
 
M

mchicke

It is part of a database that will have many purposes. This is the first. I
have created several tables for various data categories and an unbound form
with tab controls, and all unbound fields. I want to have the code update
the unbound fields to the proper tables. I also have a unbound text box for
the date, which would be used for the date field in each table. Hope this
helps.
 
O

Ofer Cohen

You can use this code to insert new record to a table

Dim MyDB As Dao.DataBase , MyRec As Dao.RecordSet
Set MyDB = CurrntDb
Set MyRec = MyDb.OpenRecordSet("Select * From TableName")
MyRec.AddNew
MyRec!FieldNameInTable = Me.[FieldNameInForm]
MyRec!Field2NameInTable = Me.[Field2NameInForm]
MyRec!Field3NameInTable = Me.[Field3NameInForm]
MyRec!Field4NameInTable = Me.[Field4NameInForm]
MyRec.Update

You can do the same to the rest of the tables
 
S

SandraL

Ofer Cohen said:
You can use this code to insert new record to a table

Dim MyDB As Dao.DataBase , MyRec As Dao.RecordSet
Set MyDB = CurrntDb
Set MyRec = MyDb.OpenRecordSet("Select * From TableName")
MyRec.AddNew
MyRec!FieldNameInTable = Me.[FieldNameInForm]
MyRec!Field2NameInTable = Me.[Field2NameInForm]
MyRec!Field3NameInTable = Me.[Field3NameInForm]
MyRec!Field4NameInTable = Me.[Field4NameInForm]
MyRec.Update

You can do the same to the rest of the tables
--
Good Luck
BS"D


mchicke said:
I should be more clear. I want to insert new records. The date field will
be used in all tables, and there is a 'shift' field that will also be used in
all tables. So there will be three records with the same date. Is this
possible, or is it too complex?
 
Top