Seperating Imported Data

sepefrio

New member
Local time
Today, 07:37
Joined
Jun 20, 2013
Messages
9
I hope the day finds everbody well. I am working on a project that just has me mind blocked and I'm sure it's a simple little thing, but I just can't get it.


I have about 700 seperate Excel spreadsheets that I need to incorporate into a single database. Each spreadsheet has about 15,000 records (rows). There are multiple problems with this task, but I have solved most of them so far. But what I am hung up on is seperating data out of one of the field. The field is a location field and it actually has 3 bits of information that need to be seperate fields. For Example: (Location is the column/field name)

Location: Miami - M0123 (Size 1)

Miami = Location Name, some names have a - in in some don't (Miami-in and Miami-out)
M0123 - Is a unique location identifier code, there are about 90 different codes
(Size1) = The size of the location, there are only 5 sizes 1 thru 5

So, instead of doing text to columns in 700 spreadsheet before importing, I am trying to seperate the data inside access. So far I have made some update queries that that work just fine by them selves.

For example: I created two new fields Location Code and Location Size. Then I made a update query where;

Criteria = like "*(Size1)
Update Location Size set to Size 1

Works great no problems. For the size, there are only 5 so no problem there. But for the location code there are 90 of them. I know I can do the same type of update query for them, but I would have to make 90 something queries and run that many for every spreadsheet imported. Do able but long and tedious.


So, I was thinking, instead of 90 queries, isn't it possible to write one long If then statement to check and update? I actually have to do this whole process twice (Assigned Location and Actual location) so I'd very much rather two long If thens vice 180+ queries.

I know how to write a if then for an equals, but not a like statement. If I could get an example of one line and most importantly, where to put it (like make a form or just run the query in a macro).

Of course, if there are any better overall ideas, that would be awesome too.


BTW - I know the size of the end product is huge, thats no problem, this is just a filter program and I will run each spreadsheet through then kick it back out in the correct excel format. The point here is to prep all the spreadsheet (which are in 3 or 4 different formats themselves) into a group that is all the eact same format so then it can be imported into a larger database later (not access).

Thank you in advance!

NOTE: Access 2007
 
Last edited:
IS your data always in the format
[location] "-" [location code] "("[size]")"

The "" contain a literal you find in every piece of data ...

If so, you can write an expression that will manipulate the text based on the positions of "-" and "(" ....
 
IS your data always in the format
[location] "-" [location code] "("[size]")"

The "" contain a literal you find in every piece of data ...

If so, you can write an expression that will manipulate the text based on the positions of "-" and "(" ....

I know what you are saying, and that is the problem, the answer is no. For example I could have


Miami - M0123 - Size 1

and

Miami-Airport - M0123 - Size 1


Both Miami and Miami Airport are Names. So if I did as you suggest, in this case Airport would be seperated out and it shouldn't be.
 
IS your data always in the format
[location] "-" [location code] "-" "("[size]")", where [location] can include "-" or blanks or whatever? If so then find the second "-" from the right, since that is your terminator for [location].

Google
Access string functions
 
IS your data always in the format
[location] "-" [location code] "-" "("[size]")", where [location] can include "-" or blanks or whatever? If so then find the second "-" from the right, since that is your terminator for [location].

Google
Access string functions


Sorry no, otherwise I could just use the text to columns in excel before I imported. The location code and size are always the same and unique, but the first part of the data, the location varies. Sometimes with a '-' sometimes without. Several of the names are foriegn sites that use "-" in the name sadly and then others who ever entered the data didn't follow convention and just put in extra stuff.
 
Sorry no, otherwise I could just use the text to columns in excel before I imported. The location code and size are always the same and unique, but the first part of the data, the location varies. Sometimes with a '-' sometimes without. Several of the names are foriegn sites that use "-" in the name sadly and then others who ever entered the data didn't follow convention and just put in extra stuff.


OK - forget the place name and focus on isolating the Code and Size? Do they have a standard number of characters, or is one always in parentheses (or Brackets for a UK site!)

If that's the case you can count back from the end of the string to identify your elements.
 
OK - forget the place name and focus on isolating the Code and Size? Do they have a standard number of characters, or is one always in parentheses (or Brackets for a UK site!)

If that's the case you can count back from the end of the string to identify your elements.


DOH! I think you got it.

Go from right to left, size is always the exact same size and code is either 4 or 5 characters, So if I go 5 characters, I might capture an extra space but I can remove that later. Thanks! Let me try it.
 

Users who are viewing this thread

Back
Top Bottom