By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

VBA add data to linked tables

P: 4
I have 3 tables, with relationships like:
Table1\Project (primary key)
Table2\Project (link to Table1)
Table2\StatusReport
Table2\Index (primary key)
Table3\Index (link to table2)
Table3\Notes

All those are one to many relationships, so

Table1 -> Table2 -> Table3
I have a form that works to input data into these, and if I browse the raw tables I also can add the data, maintaining the links and all that. The question is - how can I do it in VBA? My goal is to import from current excel-based status reports specific cells into different places in all three tables. But I don't have a clue where to start actually adding the data to the tables. I've got the excel object side of things ok, and I can read the values I want - I just don't know how to put them where they go.
Feb 4 '12 #1

✓ answered by NeoPa

Always populate the One side of a One-to-Many link first. In this case import [Table1] data, followed by [Table2], followed by [Table3].

Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,494
Always populate the One side of a One-to-Many link first. In this case import [Table1] data, followed by [Table2], followed by [Table3].
Feb 4 '12 #2

P: 4
Right - I know that's how it works when using the table or form view, but how to I do that programatically in vba code?

In other words, when I populate Table2 data, how do I make sure it is linked to the correct key in Table1?
Feb 4 '12 #3

NeoPa
Expert Mod 15k+
P: 31,494
The links are in the data itself. According to your question they are already set and in place. Why would you feel anything more than importing the data is necessary?
Feb 4 '12 #4

P: 4
You're absolutely correct - I've been thinking about this off and on during the day, and it makes total sense. All I have to do is populate the link field right, and then everything will add up correctly. Sorry for the slow thinking, and thanks for the help.
Feb 5 '12 #5

NeoPa
Expert Mod 15k+
P: 31,494
You're sorted is all that matters Bruce :-)

Besides, it's not at all unusual, even for experienced database workers, to get temporary blind-spots where the obvious is just invisible for a bit ;-)
Feb 5 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.