Problem to create form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help me. I'm from Ukraine. I beginner. I need to insert group of records (predefined number) into some table before executing another macro (to avoid key violation). How can I make this data entry form with all predefined records allow user to edit them? Thank you very much!!!
 
If you're interested only in inserting existing records
into another table, use an Append Query. Design a query
based on the table that currently contains the records of
interest, and double-click on or drag each desired field
to the query grid.

Then, choose Query, Append, and enter the name of the
table to which you wish to add these records. Click OK.
For each field, set the Append To: row to the name of the
field to which you wish the source field to be appended.

Good luck.
Best regards.
Kevin Sprinkel
-----Original Message-----
Please help me. I'm from Ukraine. I beginner. I need to
insert group of records (predefined number) into some
table before executing another macro (to avoid key
violation). How can I make this data entry form with all
predefined records allow user to edit them? Thank you very
much!!!
 
If I understand you correctly, you have a table with "n"
fields, such as:

SourceTable
-----------
Field1
Field2
Field3
....
Fieldn

and that you wish to add additional data fields to these
records, entering the new data on a form, and then you
plan to add these consolidated records to a second table.
Is this right?

If so, create a table that contains the fields that
are "missing". Also include the key field from the first
table, presumably Field1

MissingFieldsTable
------------------
Field1 (Primary Key)
Fieldn+1
Fieldn+2
....

Now, you have two tables, based on the same key, that will
hold values for all of the fields that you intend to
insert into your target table.

Now, simply create a query, linked by the key field, and
include all of the fields from both tables (what I've
called the Source table and the MissingFieldsTable).
Right click on the horizontal line joining the key field,
and change the Join Property to include all records from
the Source table and only those that match the
MissingFields table. Save the query with a meaningful
name.

Now use the Form Wizard to create a form based on this
query. All of your existing data will be there, and the
new fields will be blank. Enter the new data into your
form, and then you can post the records to the TargetTable
when you're finished, using the query as your source.

HTH
Kevin Sprinkel
-----Original Message-----
Please help me. I'm from Ukraine. I beginner. I need to
insert group of records (predefined number) into some
table before executing another macro (to avoid key
violation). How can I make this data entry form with all
predefined records allow user to edit them? Thank you very
much!!!
 
Dear Kevin I appreciate your help. My task is: I have master table (for example MatserTable) and ChildTable. There is relation beetwen tables. Also exist code (I have not to modify this code) that copy data from another format into TempTable (with the same structure as ChildTable) and then insert TempTable into ChildTable. But there ara errors key violations. So before append I think to make select query (TempTable and MasterTable) to determine missing keys in MasterTable and allow user to enter missing data in MasterTable and then execute existing code to append Temptable into ChilTable. The problem is I cannot make editable form on query and this form might has predefined number of rows. All of them must be entered correctly to avoid key violation in the future. Your advice to create temp table. Is this good. sorry for bad english.
 
OK, it sounds like you have orphan detail records on the
Many side of a One-to-Many relationship with the Master
Table. Is this true?

If so, is it possible that its parent already exists in
the Master table? If so, you can base a form on the Temp
table. Do not include the linking foreign key, but add a
combo box to the form that looks up its values from the
Master table, and has the foreign key field as its Control
Source. If a valid Master exists, you now have valid
records that you can post to the Child table.

If the parent record does not exist, you will need to add
it. One way of doing this is to set the LimitToList
property of the combo box to Yes, and create a procedure
for the OnNotInList event that allows the user to open a
form, which I presume already exists based on the Master
table. Once the new master record has been added, you
will need to Requery the combo box to allow the user to
choose this value for the detail record.

Are we getting closer?

HTH
Kevin Sprinkel

-----Original Message-----
Dear Kevin I appreciate your help. My task is: I have
master table (for example MatserTable) and ChildTable.
There is relation beetwen tables. Also exist code (I have
not to modify this code) that copy data from another
format into TempTable (with the same structure as
ChildTable) and then insert TempTable into ChildTable. But
there ara errors key violations. So before append I think
to make select query (TempTable and MasterTable) to
determine missing keys in MasterTable and allow user to
enter missing data in MasterTable and then execute
existing code to append Temptable into ChilTable. The
problem is I cannot make editable form on query and this
form might has predefined number of rows. All of them must
be entered correctly to avoid key violation in the future.
Your advice to create temp table. Is this good. sorry for
bad english.
 
Back
Top