Media player methods

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Any help on the code below would be much appreciated. It's driving me crazy!
I have a Mediaplayer activex control on a form. Every time I click on a list
of MP3 files, the url for the media player updates, and Autostart is set to
False.

' no problems with these lines
Me!WindowsMediaPlayer1.URL = Replace(DLookup("[Path] ", "[tblTracks]",
"[tblTracks]![Counter] =[lister]"), "#", "")
Me!WindowsMediaPlayer1.settings.autoStart = False
' this is the line that gives me grief
Me!WindowsMediaPlayer1.Controls.play

Every time I get the same error message - "Object does not support this
property or method".

I could leave it so that the user has to press the play button themself, but
I would potentially like to hide the activex control so all the user sees is
the list, and maybe just add a couple of buttons myself (to match the design
of the rest of the form) to stop and start.

I know that probably doesn't make much sense, but please !! why doesn't that
last line of code work!! Thanks!
 
Hi Simon

1. Get rid of the WMP ActiveX Control on your form, then,

2. Use the following code behind a Command Button:

Dim objWMP As New WindowsMediaPlayer
With objWMP
.URL = "path_to_the_media_file"
.Controls.play
End With

As simple as that!

Note that you may have to set a reference to the WMP library file (although
the reference will probably be left behind when you delete the ActiveX
control).

Cheers.

BW
 
I can only offer you eight words by way of repayment...
Thank you very very very very very much!

BeWyched said:
Hi Simon

1. Get rid of the WMP ActiveX Control on your form, then,

2. Use the following code behind a Command Button:

Dim objWMP As New WindowsMediaPlayer
With objWMP
.URL = "path_to_the_media_file"
.Controls.play
End With

As simple as that!

Note that you may have to set a reference to the WMP library file (although
the reference will probably be left behind when you delete the ActiveX
control).

Cheers.

BW

Simon Gutteridge said:
Any help on the code below would be much appreciated. It's driving me crazy!
I have a Mediaplayer activex control on a form. Every time I click on a list
of MP3 files, the url for the media player updates, and Autostart is set to
False.

' no problems with these lines
Me!WindowsMediaPlayer1.URL = Replace(DLookup("[Path] ", "[tblTracks]",
"[tblTracks]![Counter] =[lister]"), "#", "")
Me!WindowsMediaPlayer1.settings.autoStart = False
' this is the line that gives me grief
Me!WindowsMediaPlayer1.Controls.play

Every time I get the same error message - "Object does not support this
property or method".

I could leave it so that the user has to press the play button themself, but
I would potentially like to hide the activex control so all the user sees is
the list, and maybe just add a couple of buttons myself (to match the design
of the rest of the form) to stop and start.

I know that probably doesn't make much sense, but please !! why doesn't that
last line of code work!! Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top