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

Excel data to a one - to - many relationship

P: n/a
OM
How do I import excel data into 2 joined tables ?

The data is fldDate, fldTruck, fldLitres, fldSpeedometer.

fldDate goes in a table tblFuelHeader, and the rest goes in tblFuelDetail,
with a one to many relationship between tblFuelHeader and tblFuelDetail.

I have a lot of legacy data, and no desire to type it all in.

Any help greatfully received, seized upon, and used immediately.

Rob Lepper
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rob,

1. Add fldTruck, fldLitres, fldSpeedometer as new fields in tblFuelHeader
2. Link to the Excel worksheet
3. Create an append query to append fldDate, fldTruck, fldLitres,
fldSpeedometer from the linked Excel table into tblFuelHeader
4. Run the append query
5. Create an append query to append the primary key and fldTruck, fldLitres,
fldSpeedometer from tblFuelHeader into tblFuelDetail
6. Run the append query
7. Open tblFuelHeader in design view and delete the fields fldTruck,
fldLitres, fldSpeedometer

You're doing it this way so that you get a foreign key for each appended record
of fldTruck, fldLitres, fldSpeedometer that matches the primary key for each
fldDate record appended to tblFuelHeader

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"OM" <le******@loxinfo.dot.co.th> wrote in message
news:c9**********@news.loxinfo.co.th...
How do I import excel data into 2 joined tables ?

The data is fldDate, fldTruck, fldLitres, fldSpeedometer.

fldDate goes in a table tblFuelHeader, and the rest goes in tblFuelDetail,
with a one to many relationship between tblFuelHeader and tblFuelDetail.

I have a lot of legacy data, and no desire to type it all in.

Any help greatfully received, seized upon, and used immediately.

Rob Lepper

Nov 13 '05 #2

P: n/a
OM
Thank you thank you thank you !

Rob Lepper
"PC Datasheet" <No****@Nospam.Spam> wrote in message
news:oM*****************@newsread3.news.atl.earthl ink.net...
Rob,

1. Add fldTruck, fldLitres, fldSpeedometer as new fields in tblFuelHeader 2. Link to the Excel worksheet
3. Create an append query to append fldDate, fldTruck, fldLitres,
fldSpeedometer from the linked Excel table into tblFuelHeader
4. Run the append query
5. Create an append query to append the primary key and fldTruck, fldLitres, fldSpeedometer from tblFuelHeader into tblFuelDetail
6. Run the append query
7. Open tblFuelHeader in design view and delete the fields fldTruck,
fldLitres, fldSpeedometer

You're doing it this way so that you get a foreign key for each appended record of fldTruck, fldLitres, fldSpeedometer that matches the primary key for each fldDate record appended to tblFuelHeader

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"OM" <le******@loxinfo.dot.co.th> wrote in message
news:c9**********@news.loxinfo.co.th...
How do I import excel data into 2 joined tables ?

The data is fldDate, fldTruck, fldLitres, fldSpeedometer.

fldDate goes in a table tblFuelHeader, and the rest goes in tblFuelDetail, with a one to many relationship between tblFuelHeader and tblFuelDetail.

I have a lot of legacy data, and no desire to type it all in.

Any help greatfully received, seized upon, and used immediately.

Rob Lepper


Nov 13 '05 #3

P: n/a
OM
I've done this, and it works (of course), but it puts one new record in
tblFuelHeader for every new record in tblFuelDetail.

The way that tblFuelHeader works, is that there is ONE date record, and the
primary key is used in tblFuelDetail, and refers to many records that were
entered on that date.

For instance, there may be 5000 individual FuelDetails (fuel fills) in a
month, but only 31 days. This should mean that tblFuelHeader would have 31
new records, and tblFuelDetail would have 5000.

The way below has added 5000 records to both tables.

Any solutions ? Please ?

Rob Lepper

"PC Datasheet" <No****@Nospam.Spam> wrote in message
news:oM*****************@newsread3.news.atl.earthl ink.net...
Rob,

1. Add fldTruck, fldLitres, fldSpeedometer as new fields in tblFuelHeader 2. Link to the Excel worksheet
3. Create an append query to append fldDate, fldTruck, fldLitres,
fldSpeedometer from the linked Excel table into tblFuelHeader
4. Run the append query
5. Create an append query to append the primary key and fldTruck, fldLitres, fldSpeedometer from tblFuelHeader into tblFuelDetail
6. Run the append query
7. Open tblFuelHeader in design view and delete the fields fldTruck,
fldLitres, fldSpeedometer

You're doing it this way so that you get a foreign key for each appended record of fldTruck, fldLitres, fldSpeedometer that matches the primary key for each fldDate record appended to tblFuelHeader

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"OM" <le******@loxinfo.dot.co.th> wrote in message
news:c9**********@news.loxinfo.co.th...
How do I import excel data into 2 joined tables ?

The data is fldDate, fldTruck, fldLitres, fldSpeedometer.

fldDate goes in a table tblFuelHeader, and the rest goes in tblFuelDetail, with a one to many relationship between tblFuelHeader and tblFuelDetail.

I have a lot of legacy data, and no desire to type it all in.

Any help greatfully received, seized upon, and used immediately.

Rob Lepper


Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.