Hi All
Sorry if this has been posted before, I have been searching all day and had no luck. I have used another source to browse and load a audio file from a form in access, however the problem I am having is with playing the file.
The code I have is:
Now, this points to a form that has the windows media player object in it - however; I get the following error
However, if I use the source file to do it - it all works perfectly, so I am guessing that my problem is potentially different. Sorry if this is pretty basic - been a long day and I am all out of ideas.
Sorry if this has been posted before, I have been searching all day and had no luck. I have used another source to browse and load a audio file from a form in access, however the problem I am having is with playing the file.
The code I have is:
Code:
Private Sub Command114_Click()' play audio file
On Error GoTo ErrorHandler
strAudioFile = Nz(Me![txtSelectedAudioFile].Value)
If strAudioFile = "" Then
strTitle = "No file selected"
strPrompt = "Please select an audio file to play"
DoCmd.Beep
MsgBox strPrompt, vbOKOnly + vbCritical, strTitle
Me![txtSelectedAudioFile].SetFocus
GoTo ErrorHandlerExit
Else
'Check that file name and path is valid
Debug.Print "Selected audio file: " & strAudioFile
If FileExists(strAudioFile) = False Then
strTitle = "Invalid file name"
strPrompt = "File name and/or path is invalid; please re-select file"
DoCmd.Beep
MsgBox strPrompt, vbOKOnly + vbCritical, strTitle
Me![txtSelectedAudioFile].SetFocus
GoTo ErrorHandlerExit
Else
Set prj = Application.CurrentProject
If prj.AllForms("frmWindowsMediaPlayer").IsLoaded Then
DoCmd.Close acForm, "frmWindowsMediaPlayer"
End If
Me.Move Left:=2500, Top:=2500
With Me![ocxWindowsMediaPlayer]
.URL = strAudioFile
End With
End If
End If
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End Sub
Now, this points to a form that has the windows media player object in it - however; I get the following error
PHP:
Error No: 2465; Description: Microsoft Access can't find the field 'ocxWindowsMediaPlayer' referred to in your expression
However, if I use the source file to do it - it all works perfectly, so I am guessing that my problem is potentially different. Sorry if this is pretty basic - been a long day and I am all out of ideas.
Last edited: