473,769 Members | 5,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import Excel into Access Table

I've got an excel sheet that I need to import into a table, however, I
want the function to automatically manipulate the data prior to it
being imported.

For example, i have a field called [Flt No] and the format is 16107 for
example, when the VBA function is running I want it to add "EA" to the
record so it becomes EA16107 but the field I want it to import into is
called [ORDNO]

another field in the same dataset I want to import is [Product], this
field has many different product descriptions which I want to
manipulate prior to being imported.

I want to convert the following:

Premium UL - PULP
ULP - ULP
Ultimate - PULP
Unleaded Motor Spirit - ULP
LPG - LPG
Autogas - LPG
Monthly AD - Monthly AD

Any help would be wonderful, ps: I'm still an amateur in VBA

Jun 12 '06 #1
3 7478
"Santa-D" <st*****@forgon e.org> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
I've got an excel sheet that I need to import into a table, however, I
want the function to automatically manipulate the data prior to it
being imported.

For example, i have a field called [Flt No] and the format is 16107 for
example, when the VBA function is running I want it to add "EA" to the
record so it becomes EA16107 but the field I want it to import into is
called [ORDNO]

another field in the same dataset I want to import is [Product], this
field has many different product descriptions which I want to
manipulate prior to being imported.

I want to convert the following:

Premium UL - PULP
ULP - ULP
Ultimate - PULP
Unleaded Motor Spirit - ULP
LPG - LPG
Autogas - LPG
Monthly AD - Monthly AD

Any help would be wonderful, ps: I'm still an amateur in VBA


Is this a one-off import or something regular? If it's a one-off, copy your
data into the destination table then use an update query to append the
prefixes.

If this is something regular and you're new to code then post back. It
would also be useful to know what version of Access and which OS you're
using.

Regards,
Keith.
www.keithwilby.com
Jun 12 '06 #2
> If this is something regular and you're new to code then post back. It
would also be useful to know what version of Access and which OS you're
using.


Hi Keith,

I'm using Windows XP-SP2 & MS Access 2003.
Yes, it would be a regular thing and I would probably manipulate the
code and adopt it elsewhere within the system I'm building.

Jun 12 '06 #3
"Santa-D" <st*****@forgon e.org> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
If this is something regular and you're new to code then post back. It
would also be useful to know what version of Access and which OS you're
using.


Hi Keith,

I'm using Windows XP-SP2 & MS Access 2003.
Yes, it would be a regular thing and I would probably manipulate the
code and adopt it elsewhere within the system I'm building.


If you have not yet applied SP2 to Office 2003 then you can use the linked
table method to connect to Excel from Access and use the linked table as you
would a native table. Therefore you can use an append query with calculated
fields (eg Expr1: "EA" & [Flt No]).

If you have SP2 applied then the linked table method will not work with
Excel. This makes linking to Excel relatively tricky compared to the linked
table method. You'd need to first set a reference to the Excel object
library in your VBA project. You'd then need to use some code to connect to
your spreadsheet. This method is known as "Office Automation" and was new
to me until recently.

I was going to post a shed load of code at this point but I learned about
automation by reading a book and I would recommend you do the same so that
you get a good understanding rather than "monkey see, monkey do". The book
I used was this:

http://www.amazon.com/gp/product/059...Fencoding=UTF8

There is another option to consider - do you really need to store these
prefixes? If they're consistent then you can import the data as is and use
select queries at run-time to append them to form and report controls.

HTH - Keith.
www.keithwilby.com


Jun 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4012
by: Bob C. | last post by:
Question: Why would I not be able to import an Access 97 table in which some records have null values in fields that allow null values? Wouldn't the table's design be imported first, bringing the columns' "allow nulls" attribute with it? I'm dealing with both text and numeric columns. Not all columns containing nulls cause an error. Thanks,
1
6488
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access wizard..... If I have to write vb code, where is a sample??? Or do I import the excel in to a new spreadsheet and then write some kind of querey to move the data from that table
2
15513
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access wizard..... If I have to write vb code, where is a sample??? Or do I import the excel in to a new spreadsheet and then write some kind of querey to move the data from that table
6
18848
by: Paul | last post by:
I was wondering if anyone has had an issue where using vba code to read an excel file and import the data into an access table some records are not imported from the excel file. It seems looking at the data in the excel file that if the first character in the excel file cell is numeric it will read and write only numeric values only. If I sort the coloumn in the excel file and the first character in the cell read is alphanumeric then only...
2
2538
by: amy | last post by:
Hi, all: i am a new end user of access, now I have many excel files need to import to One table in access (combine all excel files into one table in excel). In excel files, some columns will have both # and text in the same column. The coloumn names in each excel file are mostly same but still a lot of different names(items). I was told to set up import specification, but how? i am not a programer or not access professional, please help...
2
9234
by: john | last post by:
I have 400 different Excel-spreadsheetfiles, same structure, all with only one record in it, and all residing in the same folder. Every now and then new Excel files are being added. In my Access file I have a form and via a button on that form I would like to periodicly automatically import all of those (new) Excelfiles in an Access table with an identical structure. What's the easiest way of making such an automated import? Is this doable?...
2
7154
by: ruthboaz | last post by:
Hi, I am exporting a table with data to an excel file.. Some fields are empty in the exported file while the others and the key field, has values. The empty field(s) in excel, will be entered with values by another department. I require to update the access db from the updated excel fields to the respective fields in the database.. While using import from the file menu, I see that the information is append the table..
1
2486
by: Tammy Viola | last post by:
I would like to import an Excel Worksheet as a new table in the backend of an Access database. Looked at using docmd.TransferSpreadsheet without success. Also looked at creating a table using the tabledef method but am stuck on the importing of the Excel Worksheet. Any assistance would be GREATLY appreciated as I have been working on this way too long now.
1
1485
by: SAHMAD | last post by:
how can i import ms access table to oracle
15
16188
by: OfficeDummy | last post by:
Hello all! I searched the Internet and this forum for a similar problem, but I found no help... Also, I'm a complete newbie to the fascinating world of programming, VBA and Access, so my question can very well be very stupid. The tasks are: 1)Import an Excel table into Access 2)Add a new column and fill it with variables of date/time type. Steps 1 and 2 need to be done only once, and I've almost managed to accomplish them. Now...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.