Can you please clarify how far you have gotton on this on your own and what your specific issue is here?
Thanks
JeffCoachman
Main Topics
Browse All TopicsScenario:
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!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
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.
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.
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.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
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.
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.
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([FieldNam
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
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
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
Business Accounts
Answer for Membership
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?