473,569 Members | 2,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import from excell

65 New Member
Hi,

I've got these files in excell that need to be imported to access. Now I've got one file, and when I try to import it, it acts weird. There are two fields in the excell fiile (Start, Stop) that are dates. When I have done my import the dates change to some number for some reason. 19/02/2007 changes into 39132. I've got an idea why it is done (dates are stored as long in access) but I got no idea how to get around this. This only happens to that format of date that needs to be imported. When I got a full date with time and all it acts normal.

Could anybody help me with this??

Greetz
Twanne

The trees don't fall far from the apple.
Sep 13 '07 #1
2 1628
Twanne
65 New Member
Owkay, never mind this. Apparently when you have something in a field you want to import from excell you cant let other (like plain text or in my case " - - ") values than the standard in the field. Access wil try to interpret this it's own way and screw up your data.

Greetz
Twanne

Throw the apple far enough.
Sep 13 '07 #2
GuillermoDG
2 New Member
If you import from Acccess with the option in the Access menu, my answer will not help you.
I import using programs (VB 2005 specifically). The basic idea is:

Dim AppExcel As Excel.Applicati on
AppExcel = New Excel.Applicati on
AppExcel.Visibl e = False

Try
AppExcel.Workbo oks.Open(Filena me:=sFileName)
Catch ex As Exception
MessageBox.Show ("Unable to open file: " + sFileName, "Error", MessageBoxButto ns.OK, MessageBoxIcon. Error)
Return
End Try

Dim sCell, sTitle As String
Dim objTitle As Object
Dim iRow As Integer
iRow = 2
Do
sCell = "B" + CStr(iRow)
AppExcel.Range( sCell).Select()
objTitle = AppExcel.Select ion.Value

On the object, or variant, you can do the validations that you want

If objTitle Is Nothing Then Exit Do
sTitle = Trim(CStr(objTi tle))
If sTitle = "" Then Exit Do
sCell = "A" + CStr(iRow)
AppExcel.Range( sCell).Select()

Here prepare and execute an INSERT command

iRow = iRow + 1
Loop
AppExcel.Workbo oks.Close()

AppExcel.Quit()
Sep 14 '07 #3

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

Similar topics

15
4193
by: daniroy | last post by:
Hello everybody, your help will be very very welcome on a very classic question... I have some Excell Macro background, a little bit of VBA knowledge. I import daily from Internet series of data. They are setup as follow, with a few more columns on the rights as stock prices, dividend and so on as: Date Code Country Adjust...
8
6544
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a macro. (I'll get to using VB later on). What I would like to do is import a single workbook w/three seperate worksheets into three seperate access...
2
1366
by: Robert Halstead | last post by:
Hi guys, I have a asp.net web app and it's connecting to an excell 2003 document (in another folder) via OleDataAdapter. Everything works and all, it's just that when I shutdown IE and try to access the excell document, asp.net seems to still keep it and won't release it. Excell gives some error saying it can't access it, but It's when I...
0
1100
by: Delforce | last post by:
Hi all, My application allows you to create a new excel file and then double click it in the list view to start it in excell. If the excell file is an existing one then I can start it now problem. The problem is when I create a new excel file in my application and try and double click it excell starts and has the name of my newly created...
2
2670
by: glibo | last post by:
I am trying to change the tab name when i open a excell spread sheet on the run time in c#. I changed it in the code: Response.AddHeader("content-disposition","filename=" + sFileName + ".xls"); But it works only on save mode but on the display mode still display the name of the page i am calling this excell spread sheet, in other words i see...
7
37582
nehashri
by: nehashri | last post by:
hello i have my data stored in different Ms Excell sheets. now I am planning to make a database of the data i have. but i m confused whether to use Postgresql or mySQL for the same. i had plans to import data directly to Ms Access but there is problem with my access for now so i have to think of other choises. i wanted to know whether it is...
2
1406
by: TMINGO | last post by:
Can you give me steps on how to import a table from excell to acess
1
1450
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I m creating a database. The data for database will fetched from an excell sheet. Now how can i read an excell sheet and update my database with that excell sheet. Or I want to show all records of excell sheet in a listbox having a title of speecific text like "Names". Thanx >> ALI <<
2
2159
by: kkshansid | last post by:
cannot import table in mysql 1i saved my excell file in csv formate 2i made a data base in mysql 3i made a table with 5 fields 4i run this file error Parse error: syntax error, unexpected T_STRING in C:\wamp\www\test\hi.php on line 16 <?php
1
7681
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...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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...
1
5514
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...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
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
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.