How to import and parse IP column from excel to four fields intoAccess 2007

S

Sandroid

Hi Easter nerds!

I have one column full of IP addresses in Excel 2007 (formatted
111.111.111.111). In Access 2007 I have IP table with ID and four IP
fields (IP1, IP2 etc.).

How I can import the data from Excel to Access that I get IP numbers
in IP table correctly?

Thanks!
 
D

Douglas J. Steele

Why not import the entire field into a temporary table, and then transfer
the data from the temporary table to the final table using the Split
function on the IP address field?
 
S

Stefan Hoffmann

hi Sandriod,

I have one column full of IP addresses in Excel 2007 (formatted
111.111.111.111). In Access 2007 I have IP table with ID and four IP
fields (IP1, IP2 etc.).
This kind of storage is imho outdated as we do

http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
How I can import the data from Excel to Access that I get IP numbers
in IP table correctly?
If the involved math is needed I would store it in one number field
(Long) or simply in a text field.

Converting an text IP to one Lond IP is quite easy: Use Split() to
divide the parts and simply add them

Dim parts() As Long
Dim result As Long

parts() = Split("111.111.111.111", ".")

result = parts(0) * &H1000000 + _
parts(1) * &H10000 + _
parts(2) * &H100 + _
parts(3) * &H1 + _

mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top