Append to Table with Indexed Field

A

aMack

I have one table "IN" which has selected records that need to be added to a
second table "BOL Control".

The "BOL Control" has a sequential/indexed field [BOL #].

Is there a process to add the records from "IN" to the "BOL Control" with
the correct indexed [BOL #] field?

Thanks
 
A

Allen Browne

If [BOL #] is an AutoNumber field, Access will assign these numbers for you.

If not, you will need to know some VBA code to achieve this. OpenRecordset
on your [IN] table, OpenRecordset on your [BOL Control] table, loop through
the records in [IN] until EOF, using AddNew and Update to add the records to
[BOL Control].

BTW, the word IN is a reserved word, so not a choose idea for a table name.
There's over 1000 names it is wise to avoid. Theres' a list of them here:
http://allenbrowne.com/AppIssueBadWord.html
and a utility to search your database and find them here:
http://allenbrowne.com/AppIssueChecker.html
 
A

aMack

Thanks Allen:

1) The table name isn't IN - I just used it for reference purposes in this
issue.

2) I am not a strong user - can you give me specifics on where to add this
VBA code?

Thanks



--
A MACKENZIE, CMA, MBA


Allen Browne said:
If [BOL #] is an AutoNumber field, Access will assign these numbers for you.

If not, you will need to know some VBA code to achieve this. OpenRecordset
on your [IN] table, OpenRecordset on your [BOL Control] table, loop through
the records in [IN] until EOF, using AddNew and Update to add the records to
[BOL Control].

BTW, the word IN is a reserved word, so not a choose idea for a table name.
There's over 1000 names it is wise to avoid. Theres' a list of them here:
http://allenbrowne.com/AppIssueBadWord.html
and a utility to search your database and find them here:
http://allenbrowne.com/AppIssueChecker.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

aMack said:
I have one table "IN" which has selected records that need to be added to a
second table "BOL Control".

The "BOL Control" has a sequential/indexed field [BOL #].

Is there a process to add the records from "IN" to the "BOL Control" with
the correct indexed [BOL #] field?

Thanks
 
A

Allen Browne

aMack, we can't write the code for you, but if you examine the previous
reply, you will find most of the keywords you would need to look up to write
that code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

aMack said:
Thanks Allen:

1) The table name isn't IN - I just used it for reference purposes in this
issue.

2) I am not a strong user - can you give me specifics on where to add this
VBA code?

Thanks



--
A MACKENZIE, CMA, MBA


Allen Browne said:
If [BOL #] is an AutoNumber field, Access will assign these numbers for
you.

If not, you will need to know some VBA code to achieve this.
OpenRecordset
on your [IN] table, OpenRecordset on your [BOL Control] table, loop
through
the records in [IN] until EOF, using AddNew and Update to add the records
to
[BOL Control].

BTW, the word IN is a reserved word, so not a choose idea for a table
name.
There's over 1000 names it is wise to avoid. Theres' a list of them here:
http://allenbrowne.com/AppIssueBadWord.html
and a utility to search your database and find them here:
http://allenbrowne.com/AppIssueChecker.html

aMack said:
I have one table "IN" which has selected records that need to be added
to a
second table "BOL Control".

The "BOL Control" has a sequential/indexed field [BOL #].

Is there a process to add the records from "IN" to the "BOL Control"
with
the correct indexed [BOL #] field?
 
Top