A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How can I play a sound when opening a switchboard in access?



 
 
Thread Tools Display Modes
  #1  
Old June 9th, 2005, 03:54 PM
Fernando
external usenet poster
 
Posts: n/a
Default How can I play a sound when opening a switchboard in access?

I'm trying to play a sound every time the access main swithboard forms opens.
  #2  
Old June 9th, 2005, 04:15 PM
Rick B
external usenet poster
 
Posts: n/a
Default

Did you do a search?

Playing a sound in a form has been documented many times.

Look at the previous posts; that's why they retain them here and in
google.com groups.

--
Rick B



"Fernando" wrote in message
...
I'm trying to play a sound every time the access main swithboard forms

opens.


  #3  
Old June 9th, 2005, 04:49 PM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default

"Fernando" wrote in message:
...

I'm trying to play a sound every time the access main swithboard forms opens.


Hi,

Here is a past post of mine on this subject which should help:


Follow this link to Allen Browne's site:

http://allenbrowne.com.au/func-04.html

1. Create a new module and add in the code as instructed
2. Then just add code like this to whatever event you
want. Such as GotFocus or something.

=PlaySound("C:\StarWarsTheme.WAV")

Make sure you include the full path and extension.

There is also code he

http://www.mvps.org/access/api/api0011.htm

Example usage like so:

Let's assume you have a field in the table called PathToSoundFile and you
have a corresponding control on the form bound to that field called
txtPathToSoundFile. The code behind the command button would now
look like this:

' *******Code Start*********
Private Sub cmdPlaySound_Click()
On Error GoTo ErrorPoint

Dim strPath As String

If Len(Nz(Me.txtPathToSoundFile, "")) = 0 Then
' No sound file path present so just ignore
' You could also play a "No Sound" file
' or a Windows one if desired
Else
' Sound file path present
strPath = Me.txtPathToSoundFile
fPlayStuff (strPath)
End If

ExitPoint:
Exit Sub

ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
' *******Code End*********

This will work with forms in Single or Continuous layout.
You optionally could save the record first if you desire as well.

Here is a sample download file by MVP Arvin Meyer:
http://www.datastrat.com/Download/WedOne.zip


In your case, just use the form's open event to play the sound

Hope that helps,
--
Jeff Conrad
Access Junkie
http://home.bendbroadband.com/conrad...essjunkie.html
http://www.access.qbuilt.com/html/articles.html


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint 2003 does not play sound file with word 'silence' Pancras Powerpoint 9 May 17th, 2005 10:51 AM
my reminders do not play a sound Whiteox General Discussion 4 May 4th, 2005 12:05 AM
cannot play sound in pps/ppt Aaron Powerpoint 6 April 25th, 2005 05:38 PM
Sound Library Questions Al Stearns Powerpoint 2 May 25th, 2004 02:47 AM


All times are GMT +1. The time now is 03:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.