Temporary Tables??? Where to Start???

Bopsgtir

Registered User.
Local time
Today, 11:12
Joined
Jan 1, 2011
Messages
52
Hi all im designing my first ever database, and would like to know the best way to import data from excel which isnt normalised. below are the headings in excel and also what time of information which would be in each column, this report comes from Esso every month, so i dont really want to play with the orginal format, id like Access to do all of that for me.


Account No Always the same 7 digit number

Date Drawn Time and date of the purchase

Card # A 3 digit number assigned to the tech so this would be repeated data

Site Name Abbreviated name of a petrol station this could be any garage in the uk

Transaction # A unique 12 digit number

Reg at Site Van Registration number, the same reg will be on here multiple times

Reg on Card Also left blank

Driver on Card Name of the Driver so more repeated data

Odometer the milege of the van this is sometimes blank

Product two options DERV (diesel) or LUBE (Oil)

Qty How many litres

Inv Price Cost per Unit

Cost of Sale Total cost as a currency

Inv Date im invoiced twice a month so this would be a date either the 15th of the month or the 28th of the month

Inv Number Again twice a month all the records are attached to an invoice number so this is recurring data

Bunker Diesel Always shows as FALSE

Est Price The same as the Cost per unit

Cost Centre Always Blank

Driver Description Always Blank


Please can anyone point me in the right direction with how to do this, ive been reading up about importing it all into a tempory table then using sql to move the information to proper tables?? but i wouldnt know where to start with this???
 
So export everything into a table, move parts into there relevant tables then clear the temp table??
 
I do this all the time. The challenge is to bring the data into tables that, if properly designed, are related by ID columns, as I know yours are. So, as the data go into the tables, new IDs are incremented. Usually, you have to create am updateable query that does a JOIN on literal values, includes the newly created IDs and writes them to the FK column in the parent table.
 
right this is now what ive got

this is what im importing and if its needed


TblFuelUsage
ID Keep
Account Keep
DateDrawn Keep
Card Keep
SiteName Keep
Transaction No Keep
RegAtSite Keep
RegOnCard Not Needed
DriverOnCard Not Needed
Odometer Keep
Product Keep
Quantity Keep
UnitPrice Keep
CostOfSale Keep
InvoiceDate Keep
InvoiceNumber Keep
BunkerDiesel Not Needed
EstimatedPrice Not Needed
CostCentre Not Needed
DriverDescriptom Not Needed

so if i delete all the not needed fields i get

NewFuelUsage
ID
Account New Table ID and AccountNumber
DateDrawn
Card Foreignkey To Link this table
SiteName
Transaction No
RegAtSite
Odometer
Product New Table ID and Product
Quantity
UnitPrice
CostOfSale Do I Need this as its just Quantity multiplied by UnitPrice
InvoiceDate New Table ID Invoice Date and Invoice Number
InvoiceNumber New Table ID Invoice Date and Invoice Number

And that would need to be broken down into 4 tables i think??

TblFuelUsage
ID
LookupToAccountNumber
DateDrawn
Card FK
SiteName
TransactionNumber
RegAtSite
Odemeter
ProductLookup
Quantity
UnitPrice
CostOfSale Do I Need this as its just Quantity multiplied by UnitPrice


TblEssoAccount
ID
AccountNumber

TblFuelInvoices
ID
InvoiceDate
InvoiceNumber

TblProduct
ID
Product

Does that look ok, i just now need to work out how the information gets put into the tables with SQL then i just delete the orginal table ready for next time.
 
Yeah you seem to be on the right track, no need to delete the table, just delete the records.

The key is to reformat your excel sheet to a certain standard before importing it to avoid confusing Access
 
Yes sorry i did mean delete the records not the table, has anyone got any links to info on getting that information split into the other tables??
 
bopsgtir

seriously - if you are new to database design, and this is for a company - i would get some professional help in, at least to help you deisgn your new database, and steer you on the right path.
 
Hi dave. This is more for my own learning than a task. I'd like to show my boss the benifits of what access can bring in a workable solution. If he agreeds to take it further then I would speak to a professional. I'm just getting involved as I enjoy learning and find all this really intresting.
 
I'd like to show my boss the benifits of what access can bring in a workable solution.

At this rate you'll actually steer him away from Access haha j/k

Anyways, so your problem is, how to split one table into four smaller tables?

I saw a one-one relationship in your diagram as well, I stay away from those unless my table gets to 100 fields
 

Users who are viewing this thread

Back
Top Bottom