471,076 Members | 1,260 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,076 software developers and data experts.

Excel data to a one - to - many relationship

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
3 4407
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
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
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.

Similar topics

reply views Thread by WindAndWaves | last post: by
1 post views Thread by Jim Heavey | last post: by
1 post views Thread by }{ | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.