Question

Data Manipulation XLS or MDB ~ Substring Extraction

Asked by: kboles101

Scenario:

The code section contains data from 2 different XLS dumps, which needs to be massaged in order to accurately generate MS Access reports. All that is relevant is the extraction of the MPG file name; anything / everything else is extraneous.

Notes:

* A JPG file name often accompanies an MPG file name in the same cell and does not always present in the same order.
.
* MPG file names can be longer than 8 characters.  

Alternatively, a "Like" query in MS Access might suffice???

Thoughts?

Thanks Experts!!

XLS #1
 
0025323.MPG 
0025318.MPG 
0025319.MPG 
A0011056.JPG 0011056.MPG 
0024329.MPG 
0024435.MPG 
0024408.MPG 
0011939.MPG 
0024228_A.JPG 0024228.MPG 
0025311_A.JPG 0025311.MPG 
0022099.MPG 
0024344_A.JPG 0024344.MPG 
0024345_A.JPG 0024345.MPG 
0024109_A.JPG 0024109.MPG 
0025330_A.JPG 0025330.MPG 
0024900_A.JPG 0024900.MPG 
0024861_A.JPG 0024861.MPG 
A0024906.JPG 0024906.MPG 
A0021138.JPG 0021138.MPG 
A0024904.JPG 0024904.MPG 
A0024907.JPG 0024907.MPG 
A0024715.JPG 0024715.MPG 
A0025022.JPG 0025022.MPG 
A0024777.JPG 0024777.MPG 
A0024930.JPG 0024930.MPG 
A0024911.JPG 0024911.MPG 
A0024915.JPG 0024915.MPG 
A0024923.JPG 0024923.MPG 
A0023585.JPG 0023585.MPG 
0022824.MPG A0022824.JPG 
0021897.MPG A0021897.JPG 
0023248.MPG A0023248.JPG 
A0024929.JPG 0024929.MPG 
A0022178.JPG 0022178.MPG 
0018842.MPG 
A0024358.JPG 0024358.MPG 
A0024908.JPG 0024908.MPG 
A0022634.JPG 0022634.MPG 
A0024927.JPG 0024927.MPG 
A0024991.JPG 0024991.MPG 
A0025068.JPG 0025068.MPG 
A0024992.JPG 0024992.MPG 
A0025348.JPG 0025348.MPG 
A0025455.JPG 0025455.MPG 
A0025371.JPG 0025371.MPG 
A0024798.JPG 0024798.MPG 
A0025767.JPG 0025767.MPG 
A0025456.JPG 0025456.MPG 
A0025355.JPG 0025355.MPG 
A0025474.JPG 0025474.MPG 
A0025475.JPG 0025475.MPG 
A0026102.JPG 0026102.MPG 
A0025457.JPG 0025457.MPG 
A0025738.JPG 0025738.MPG 
0026263.MPG 
A0025510.JPG 0025510.MPG 
A0025643.JPG 0025643.MPG 
A0025642.JPG 0025642.MPG 
A0024910.JPG 0024910.MPG 
A0025073.JPG 0025073.MPG 
A0025734.JPG 0025734.MPG 
A0025654.JPG 0025654.MPG 
A0026041.JPG 0026041.MPG 
A0024776.JPG 0024776.MPG 
A0025469.JPG 0025469.MPG 
 
 
XLS #2
 
/r1/CCS2!0024992.mpg
/r1/CCS2!0025068.mpg
/r1/CCS2!0023599.mpg
/r1/CCS2!0024910.mpg
/r1/CCS2!0025469.mpg
/r1/CCS2!0011056.mpg
/r1/CCS2!0025738.mpg
/r1/CCS2!0024715.mpg
/r1/CCS2!0025371.mpg
/r1/CCS2!1002496.mpg
/r1/CCS2!0024910.mpg
/r1/CCS2!0024715.mpg
/r1/CCS2!0024929.mpg
/r1/CCS2!0025738.mpg
/r1/CCS2!0023599.mpg
/r1/CCS2!0024910.mpg
/r1/CCS2!0024344.mpg
/r1/CCS2!0024900.mpg
/r1/CCS2!0024228.mpg
/r1/CCS2!0025767.mpg
/r1/CCS1!pevod719.mpg
/r1/CCS2!1013998.mpg
/r1/CCS2!0025475.mpg
/r1/CCS2!0022178.mpg
/r1/CCS2!0025371.mpg
/r1/CCS2!0024345.mpg
/r1/CCS2!0025643.mpg
/r1/CCS2!0025469.mpg
/r1/CCS2!0024910.mpg
/r1/CCS2!0022178.mpg
/r1/CCS2!0025767.mpg
/r1/CCS2!0025348.mpg
/r1/CCS2!0024923.mpg
/r1/CCS2!0025510.mpg
/r1/CCS2!0025734.mpg
/r1/CCS2!0025475.mpg
/r1/CCS2!0022178.mpg
/r1/CCS1!pevod532.mpg
/r1/CCS2!0024798.mpg
/r1/CCS2!0024798.mpg
/r1/CCS2!1000800.mpg
/r1/CCS2!0025643.mpg
/r1/CCS2!0025510.mpg
/r1/CCS2!1000800.mpg

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-28 at 07:51:01ID24851142
Topics

Microsoft Excel Spreadsheet Software

,

Access Reports

,

Access Coding/Macros

Participating Experts
2
Points
500
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. How to insert a image(bmp or jpg) into a mdb?
    How to insert a image(bmp or jpg) into a mdb? I'm using vc++6.0 and mfc. THANKS
  2. MP3 to MPG
    I want to convert my MP3 files to MPG, so I can write to VCD and play with VCD player. What the software can combine MP3 file and a picture file (BMP,JPG,PCX or others) to produce MPG (Audio and picture) ? It's better if that software can run from DOS command line so we can m...
  3. convert mpg to jpg
    other than a screan capture can mpg be converted to jpg or bmp
  4. Convert .jpg to .mpg
    I want to create a slideshow of my pictures that I can play on a dvd player. I can make a slide show on cd that plays on my computer but I need it to play on a dvd attached to the tv. I have easy cd creator 5 which will create the video cd but it only works with .mpg or .mpeg...
  5. XLS
    If i use "sheet1.cells(1,1) = textbox1.text" it will show on cell A1 but how about i want it to appear at other xls file but in the same cell. such as in abc.xls cells A1 instead of fgh.xls cells A1.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: capricorn1Posted on 2009-10-28 at 08:18:14ID: 25684192

you can do this using VBA codes in Access.

are those the only formats of the data?

 

by: boag2000Posted on 2009-10-28 at 08:19:01ID: 25684207

Can you please clarify how far you have gotton on this on your own and what your specific issue is here?

Thanks

JeffCoachman

 

by: boag2000Posted on 2009-10-28 at 08:19:50ID: 25684223

Sorry,

My post should have been:

I am having trouble determining what your question is here?
How to extract the data?
How to extract the image?
How to import the data?
...etc

Can you please clarify how far you have gotten on this on your own and what your specific issue is here?

Thanks

JeffCoachman

 

by: kboles101Posted on 2009-10-28 at 08:33:15ID: 25684389

Answer #1  Yes, 2 data types.

Answer #2 The objective is to extract just the MPG file name from both XLS dumps. One is a log file; another is a content catalog. Both will be imported into MS Access for in order to generate a "Number of Plays" query. I had this in place, but the source data structures changed slightly fouling the reports. Reiterating, it would be nice to be able to boil both XLSes down to the point where only the MPG file name is listed. Anything else is extraneous including the CCS1! & CCS2!. Thanks again.      

 

by: capricorn1Posted on 2009-10-28 at 08:49:42ID: 25684603

first, import the .xls file in an access table
create a field (MPG) to hold the extracted .mpg file

to populate the field, use an update query

Update tableX set [MPG]=ExtractMPG([FieldName])

paste this codes in a regular module

Function ExtractMPG(sFld As String)
Dim sDel As String
If Len(sFld & "") = 0 Then ExtractMPG = "": Exit Function

If InStr(sFld, " ") Then sDel = " "
If InStr(sFld, "!") Then sDel = "!"

If Len(sDel & "") > 0 Then
   
    ExtractMPG = Mid(sFld, InStr(sFld, sDel) + 1)
    Else
    If Right(sFld, 4) = ".mpg" Then
        ExtractMPG = sFld
        Else
        ExtractMPG = ""
    End If
End If

End Function

 

by: kboles101Posted on 2009-10-28 at 09:18:04ID: 25684925

Data is imported, MPG field created. Could you offer additional detail with respect to the steps required  to create the update query and enter the function in MS Access? Thanks Capricorn1.  

 

by: capricorn1Posted on 2009-10-28 at 09:27:04ID: 25685041

from the database objects window
select Modules > new

in the VBA window that will open copy and paste this

'*****
Function ExtractMPG(sFld As String)
Dim sDel As String
If Len(sFld & "") = 0 Then ExtractMPG = "": Exit Function

If InStr(sFld, " ") Then sDel = " "
If InStr(sFld, "!") Then sDel = "!"

If Len(sDel & "") > 0 Then
   
    ExtractMPG = Mid(sFld, InStr(sFld, sDel) + 1)
    Else
    If Right(sFld, 4) = ".mpg" Then
        ExtractMPG = sFld
        Else
        ExtractMPG = ""
    End If
End If

End Function
'*******


to create an update query
select Queries > New > Design View >Ok

select the Table then click Add, Close
see the image below

 

by: kboles101Posted on 2009-10-28 at 09:56:35ID: 25685405

Getting Closer; Function Error when running query...please advise. Thanks!

 

by: capricorn1Posted on 2009-10-28 at 10:04:52ID: 25685500

first, make sure that you did not save the module as ExtractMPG, if you did rename it to something different than the function name, like modExtractMPG

second, in your query
change this

ExtractMPG("Asset_Namempg")

to

ExtractMPG([Asset_Namempg])

 

by: kboles101Posted on 2009-10-28 at 10:15:11ID: 25685633

Success with the first data set; testing second XLS data set. Thanks Capricorn1  

 

by: kboles101Posted on 2009-10-28 at 10:41:26ID: 25686031

Seemed to miss under the following conditions:

* When the MPG file began with "0" and did not have an accompanying JPG
* When both an MPG and JPG existed and the JPG presented second in the cell.

Thoughts? Thanks!!

 

by: capricorn1Posted on 2009-10-28 at 10:56:23ID: 25686197

modify the function like this


Function ExtractMPG(sFld As String)
Dim sDel As String

sFld = Trim(sFld)    '<< ADD THIS LINE

If Len(sFld & "") = 0 Then ExtractMPG = "": Exit Function

If InStr(sFld, " ") Then sDel = " "
If InStr(sFld, "!") Then sDel = "!"

If Len(sDel & "") > 0 Then
   
    ExtractMPG = Mid(sFld, InStr(sFld, sDel) + 1)
    Else
    If Right(sFld, 4) = ".mpg" Then
        ExtractMPG = sFld
        Else
        ExtractMPG = ""
    End If
End If

End Function

 

by: kboles101Posted on 2009-10-28 at 11:07:09ID: 25686327

No Change. Hmmm....

 

by: capricorn1Posted on 2009-10-28 at 11:09:57ID: 25686371

post the excel file. upload it here

 

by: kboles101Posted on 2009-10-28 at 11:21:50ID: 25686503

Data Set #2 Upload; Thanks for your diligence.

 

by: capricorn1Posted on 2009-10-28 at 12:15:23ID: 25687078

see this sample db

open table VOD_Content_Report, close table

run Query1, open table VOD_Content_Report again

 

by: kboles101Posted on 2009-10-28 at 12:33:59ID: 25687291

Capricorn1, did you notice a few JPGs were returned instead of the MPGs? Thanks again, your assistance is really appreciated!

 

by: capricorn1Posted on 2009-10-28 at 12:37:54ID: 25687342

now, that is the reason i ask in my first post about the data format.

 

by: capricorn1Posted on 2009-10-28 at 12:46:32ID: 25687438

test this

 

by: kboles101Posted on 2009-10-28 at 12:46:55ID: 25687441

Sorry if I was not clear earlier. The JPG / MPG order and formats are determined by the application.  

 

by: kboles101Posted on 2009-10-28 at 12:49:34ID: 31647002

Great; Thank you Capricorn1

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...