J
jonesfranckandi
hi, everyone,
I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone think they
can
help me?. Here take a look at this code:
Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie
If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If
End Sub
-------------------------------------------------------------------
Private Sub Close_Click()
Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub
My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.
Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!
I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone think they
can
help me?. Here take a look at this code:
Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie
If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If
End Sub
-------------------------------------------------------------------
Private Sub Close_Click()
Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub
My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.
Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!