• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

play a video via ms access form

Hi:
How can I play a video via ms access form?
please
0
Mohammad Alsolaiman
Asked:
Mohammad Alsolaiman
  • 3
  • 2
2 Solutions
 
rockiroadsCommented:
Simple example without creating a control but doing it in vba

add a windows media player reference (via Tools/References from vba editor)

define a form level variable then create buttons to play and stop
eg

you have a variable called wmp and you create buttons to allow playing

define in form (near top)

Dim wmp As WindowsMediaPlayer


Now you need to initialise when the form loads and close it down when form closes

Private Sub Form_Load()
    Set wmp = New WindowsMediaPlayer
End Sub

Private Sub Form_Close()
    Set wmp = Nothing
End Sub


To play a video, you can do this

'Use this line to clear current play list
    wmp.currentPlaylist.clear

'Add this to playlist - special mention to one of the top experts here DatabaseMX
    wmp.currentPlaylist.appendItem m_WMP.newMedia(c:\DatabaseMXDoesntWatchPronHonest.avi")

'Start play
    wmp.Controls.Play


to stop, you got to do this

    wmp.Controls.Stop
0
 
TextReportCommented:
If this is a file then you can shell windows media player and pass the file to it. To run the function then you can set the OnClick event to

=PlayVideo("C:\Users\Public\Videos\Sample Videos\Lake.wmv")

Cheers, Andrew
Function PlayVideo(pstrFile As String)
Dim strPlayer As String
 
    strPlayer = Chr(34) & "C:\Program Files\Windows Media Player\wmplayer.exe" & Chr(34)
    Shell strPlayer & " " & Chr(34) & pstrFile & Chr(34), vbMaximizedFocus
End Function

Open in new window

0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks a lot
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Mohammad Alsolaimanapplication programmerAuthor Commented:
"Chr(34)" what dose it mean please ?
0
 
TextReportCommented:
The CHR() function returns a charcter represented by the ASCII value, 34 is the double quote character " and as you need this in the string it is the easiest way to read the code

strPlayer = Chr(34) & "C:\Program Files\Windows Media Player\wmplayer.exe" & Chr(34)

the above could be written as
strPlayer = """C:\Program Files\Windows Media Player\wmplayer.exe"""

Cheers, Andrew
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks a lot "Andrew"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now