Did you try importing into a new database, like I suggested?
'*** Start Code ***
Option Compare Database
Option Explicit
' Extremely simplistic code to use the Media Control Interface APIs to play
an MP3 file
' Samples of how to call the code:
' To play a file:
'
' PlayMP3 "C:\myMP3.mp3"
'
' To stop playing the current file:
'
' StopMP3
'
' To pause the current file:
'
' PauseMP3
'
'The mciGetErrorString function retrieves a string that describes the
specified MCI error code.
Private Declare Function mciGetErrorString Lib "winmm.dll" _
Alias "mciGetErrorStringA" ( _
ByVal dwError As Long, _
ByVal lpstrBuffer As String, _
ByVal uLength As Long _
) As Long
'The mciSendString function sends a command string to an MCI device.
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" ( _
ByVal lpstrCommand As String, _
ByVal lpstrReturn128String As String, _
ByVal uReturnLength As Long, _
ByVal hwndCallback As Long _
) As Long
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" ( _
ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long _
) As Long
Public Function PlayMP3(FileName As String) As String
' This code was originally written by
' Doug Steele, MVP
[email protected]
' You are free to use it in any application
' provided the copyright notice is left unchanged.
'
' Description: Starts playing a given MP3 file
'
' Inputs: Full path to the MP3 file
'
' Returns: A zero-length string if the file can be played,
' or a string indicating the error if it can't be
'
Dim lngReturn As Long
Dim strCommand As String * 255
Dim strReturn128 As String * 128
Dim strReturn255 As String * 255
Dim strShortPathAndFile As String
' Make sure the file actually exists
If Len(Dir(FileName)) > 0 Then
' MCI doesn't recognize long file names.
' Use GetShortPathName to convert the file name to an
' acceptable format
lngReturn = GetShortPathName(FileName, strReturn255, 255)
strShortPathAndFile = Left$(strReturn255, lngReturn)
' Use mciSendString to indicate what file to play.
' If the file's okay, the call to mciSendString will return 0.
' IN that case, use mciSendString to indicate that playing should begin.
' If it's not okay, a subsequent call to mciGetErrorString
' will indicate what's wrong.
' Note that you must pass an Alias name along with the file when opening it.
' All subsequent calls must use this same alias, and you cannot use the
' same alias again until the close command has been issued for that specific
alias
strCommand = "open " & strShortPathAndFile & " Type MPEGVideo Alias
MyMP3"
lngReturn = mciSendString(strCommand, 0&, 0&, 0&)
If lngReturn = 0 Then ' success
lngReturn = mciSendString("play MyMP3", 0&, 0&, 0&)
If lngReturn = 0 Then ' success
PlayMP3 = vbNullString
Else
Call mciGetErrorString(lngReturn, strReturn128, 128)
PlayMP3 = TrimNull(strReturn128)
Err.Raise vbObjectError + lngReturn, "PlayMP3",
TrimNull(strReturn128)
End If
Else
Call mciGetErrorString(lngReturn, strReturn128, 128)
PlayMP3 = TrimNull(strReturn128)
Err.Raise vbObjectError + lngReturn, "PlayMP3",
TrimNull(strReturn128)
End If
Else
PlayMP3 = "Input File does not exist."
End If
End Function
Public Sub PauseMP3()
' This code was originally written by
' Doug Steele, MVP
[email protected]
' You are free to use it in any application
' provided the copyright notice is left unchanged.
'
' Description: Pauses the currently-playing song
'
' Inputs: None
Dim lngReturn As Long
Dim strReturn128 As String * 128
' Note that you must use the same Alias name as was used in PlayMP3
lngReturn = mciSendString("pause MyMP3", 0&, 0&, 0&)
If lngReturn <> 0 Then ' error
Call mciGetErrorString(lngReturn, strReturn128, 128)
Err.Raise vbObjectError + lngReturn, "PauseMP3",
TrimNull(strReturn128)
End If
End Sub
Public Sub ResumeMP3()
' This code was originally written by
' Doug Steele, MVP
[email protected]
' You are free to use it in any application
' provided the copyright notice is left unchanged.
'
' Description: Resumes playing the currently loaded file
'
' Inputs: None
Dim lngReturn As Long
Dim strReturn128 As String * 128
' Note that you must use the same Alias name as was used in PlayMP3
lngReturn = mciSendString("resume MyMP3", 0&, 0&, 0&)
If lngReturn <> 0 Then ' error
Call mciGetErrorString(lngReturn, strReturn128, 128)
Err.Raise vbObjectError + lngReturn, "ResumeMP3",
TrimNull(strReturn128)
End If
End Sub
Public Sub StopMP3()
' This code was originally written by
' Doug Steele, MVP
[email protected]
' You are free to use it in any application
' provided the copyright notice is left unchanged.
'
' Description: Stops playing the current song
'
' Inputs: None
' Note that you must use the same Alias name as was used in PlayMP3
Dim lngReturn As Long
Dim strReturn128 As String * 128
lngReturn = mciSendString("stop MyMP3", 0&, 0&, 0&)
If lngReturn = 0 Then ' success
lngReturn = mciSendString("close MyMP3", 0&, 0&, 0&)
If lngReturn <> 0 Then ' error
Call mciGetErrorString(lngReturn, strReturn128, 128)
Err.Raise vbObjectError + lngReturn, "StopMP3",
TrimNull(strReturn128)
End If
Else
' If the device has already been closed, lngReturn will be 263
' ("The specified device is not open or is not recognized by MCI.")
' Ignore that error, since it'll usually mean that we've already
' closed the device by clicking on the Stop button.
If lngReturn <> 263 Then
Call mciGetErrorString(lngReturn, strReturn128, 128)
Err.Raise vbObjectError + lngReturn, "StopMP3",
TrimNull(strReturn128)
End If
End If
End Sub
' *** End Code ***
It's possble that you might have to use something other than:
strCommand = "open " & strShortPathAndFile & " Type MPEGVideo Alias MyMP3"
The "Alias MyMP3" will be fine, but the "MPEGVideo" may need to be changed.