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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Play .wav file at DB start-up
these newsgroups are for the FREE exchange of ideas, information, and
assistance. this is absolutely NOT the place to troll for business, such postings are not welcome, and they make such a bad impression that it can only hurt your reputation in the Access community. if you want to post actual advice and assistance here in the newsgroups for all to benefit from, or post questions of your own, then your participation will be welcomed. PACALA wrote in message ... NO PROBLEMS, CONTACT ME... -- PACALA JAN [ACCESS DEVELOPER] SEND 10$ TO... ACCOUNT: SK31 1100 0000 0026 1674 0428 SwiftCode: TATRSKBX Tatra banka as,Hodzovo nam.3, 811 06 Bratislava SKYPE: PACALA.BA1 "Chad" wrote: Hello, I have a file named song1.wav and its in a folder named Songs. How do I have my database play this song at startup. I move my database to and from work so the file path wont be the same but the folder "Songs" is always with the database. I have found the code below and it works but its pointing to windows media folder ect. Here is the code: Module: Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Public Sub PlaySound(strSound) Call sndPlaySound32(strSound, 0) End Sub On load event of my opening form: Call PlaySound("C:\Windows\Media\Whoosh.wav") Thanks!!! -- Newbies need extra loven......... |
#12
|
|||
|
|||
Play .wav file at DB start-up
Hi
The obvious answer is to copy the WAV file into a folder that also holds the Database. Would this be a problem. -- Wayne Manchester, England. "Chad" wrote: Wayne, I really appreciate the well expalined post but I understand how to make a module and where to put the code and how to find the path. My problem is that I move that database around and the sound file wont be in the same place as my home PC and work PC's. I wanted to do something as to where it finds the path for example im using this in a report to bring up pictures from a folder named RejectSteelBarCodes and this forlder always stays with my DB. How would I incorporate something like this but use a folder named Sounds to find the .wav file I am wanting? Oh and how about a delicious cookie baked fresh from the oven instead of the cake....Thanks! strPath = CurrentProject.Path & "\RejectSteelBarCodes\" strDir = Dir(strPath) -- Newbies need extra loven......... "Wayne-I-M" wrote: Hi Chad Playing a sound on various events in/on a form is quite simple (IF you know how). So 1st can we agree on my price. I never charge less than one absolutely huge cream cake. You can send this to me at Wayne-i-m c/o the British Post Office, England. I am sure it will arrive sooner or later. Oh if a cream cake is too much I will let you negotiate me down but no lower than a jam donut. You say you have looked around for some help and can’t understand it – me too, some of it, so don’t worry nothing is clear “until you get it, only then is it simple. If you have a look a the module on Allan Browns site http://allenbrowne.com You will it looks like this Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function So – to use this - do this In your access database you will have (on the left of the screen) choices of Tables Queries Forms Reports Pages Macros Modules Select Modules Select New You will arrive at a screen with Option Compare Database Cut and paste Allan’s code (paste just below Option Compare Database) it will now look like this Option Compare Database Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long ___________________________________________ Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function I drew the line in the code above as that is what you will see . Save this as whatever you want (but something that makes sense to you AND more importantly anyone else who may, in the future, work on the programming) Next Open your form in design view Right click the form area outside the detail section (the grey area) Select properties Select the Event Column Right click the OnLoad row Select Build (…) Select Code You will see this Private Sub Form_Load() End Sub You need to write only one line of code (like this) PlaySound (Path to WAV file) It will look something like (but not exactly like) this Private Sub Form_Load() PlaySound ("C:\WINDOWS\Media\chord.wav") End Sub OK up to now I hope. You MUST know the full path of the WAV. You can get it by clicking Start Run Browse (Select all files in the file type box) Navigate to your WAV file and select it. Click run Cut the path out of the run box and paste it into the code between the ( ) Hey-presto Hope this helps -- Wayne Manchester, England. "Chad" wrote: PACALA, The discussion Group isn’t a place to do business it’s a place to help people! I think this is very unprofessional.... Newbies need extra loven......... "PACALA" wrote: NO PROBLEMS, CONTACT ME... -- PACALA JAN [ACCESS DEVELOPER] SEND 10$ TO... ACCOUNT: SK31 1100 0000 0026 1674 0428 SwiftCode: TATRSKBX Tatra banka as,Hodzovo nam.3, 811 06 Bratislava SKYPE: PACALA.BA1 "Chad" wrote: Hello, I have a file named song1.wav and its in a folder named Songs. How do I have my database play this song at startup. I move my database to and from work so the file path wont be the same but the folder "Songs" is always with the database. I have found the code below and it works but its pointing to windows media folder ect. Here is the code: Module: Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Public Sub PlaySound(strSound) Call sndPlaySound32(strSound, 0) End Sub On load event of my opening form: Call PlaySound("C:\Windows\Media\Whoosh.wav") Thanks!!! -- Newbies need extra loven......... |
#13
|
|||
|
|||
Play .wav file at DB start-up
Wayne-I-M wrote:
So 1st can we agree on my price. I never charge less than one absolutely huge cream cake. You can send this to me at Wayne-i-m c/o the British Post Office, England. I am sure it will arrive sooner or later. Oh if a cream cake is too much I will let you negotiate me down but no lower than a jam donut. You say you have looked around for some help and can’t understand it – me too, some of it, so don’t worry nothing is clear “until you get it, only then is it simple. Well said. I'll have to try that myself some day. Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ |
#14
|
|||
|
|||
Play .wav file at DB start-up
Yes that is the obvious answer! But, What if I move my databse from point A
to point B all the time? Now im going to have to change the path on every button in my datbase to wherever the sound file resides Right? Thanks! -- Newbies need extra loven......... "Wayne-I-M" wrote: Hi The obvious answer is to copy the WAV file into a folder that also holds the Database. Would this be a problem. -- Wayne Manchester, England. "Chad" wrote: Wayne, I really appreciate the well expalined post but I understand how to make a module and where to put the code and how to find the path. My problem is that I move that database around and the sound file wont be in the same place as my home PC and work PC's. I wanted to do something as to where it finds the path for example im using this in a report to bring up pictures from a folder named RejectSteelBarCodes and this forlder always stays with my DB. How would I incorporate something like this but use a folder named Sounds to find the .wav file I am wanting? Oh and how about a delicious cookie baked fresh from the oven instead of the cake....Thanks! strPath = CurrentProject.Path & "\RejectSteelBarCodes\" strDir = Dir(strPath) -- Newbies need extra loven......... "Wayne-I-M" wrote: Hi Chad Playing a sound on various events in/on a form is quite simple (IF you know how). So 1st can we agree on my price. I never charge less than one absolutely huge cream cake. You can send this to me at Wayne-i-m c/o the British Post Office, England. I am sure it will arrive sooner or later. Oh if a cream cake is too much I will let you negotiate me down but no lower than a jam donut. You say you have looked around for some help and can’t understand it – me too, some of it, so don’t worry nothing is clear “until you get it, only then is it simple. If you have a look a the module on Allan Browns site http://allenbrowne.com You will it looks like this Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function So – to use this - do this In your access database you will have (on the left of the screen) choices of Tables Queries Forms Reports Pages Macros Modules Select Modules Select New You will arrive at a screen with Option Compare Database Cut and paste Allan’s code (paste just below Option Compare Database) it will now look like this Option Compare Database Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long ___________________________________________ Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function I drew the line in the code above as that is what you will see . Save this as whatever you want (but something that makes sense to you AND more importantly anyone else who may, in the future, work on the programming) Next Open your form in design view Right click the form area outside the detail section (the grey area) Select properties Select the Event Column Right click the OnLoad row Select Build (…) Select Code You will see this Private Sub Form_Load() End Sub You need to write only one line of code (like this) PlaySound (Path to WAV file) It will look something like (but not exactly like) this Private Sub Form_Load() PlaySound ("C:\WINDOWS\Media\chord.wav") End Sub OK up to now I hope. You MUST know the full path of the WAV. You can get it by clicking Start Run Browse (Select all files in the file type box) Navigate to your WAV file and select it. Click run Cut the path out of the run box and paste it into the code between the ( ) Hey-presto Hope this helps -- Wayne Manchester, England. "Chad" wrote: PACALA, The discussion Group isn’t a place to do business it’s a place to help people! I think this is very unprofessional.... Newbies need extra loven......... "PACALA" wrote: NO PROBLEMS, CONTACT ME... -- PACALA JAN [ACCESS DEVELOPER] SEND 10$ TO... ACCOUNT: SK31 1100 0000 0026 1674 0428 SwiftCode: TATRSKBX Tatra banka as,Hodzovo nam.3, 811 06 Bratislava SKYPE: PACALA.BA1 "Chad" wrote: Hello, I have a file named song1.wav and its in a folder named Songs. How do I have my database play this song at startup. I move my database to and from work so the file path wont be the same but the folder "Songs" is always with the database. I have found the code below and it works but its pointing to windows media folder ect. Here is the code: Module: Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Public Sub PlaySound(strSound) Call sndPlaySound32(strSound, 0) End Sub On load event of my opening form: Call PlaySound("C:\Windows\Media\Whoosh.wav") Thanks!!! -- Newbies need extra loven......... |
#15
|
|||
|
|||
Play .wav file at DB start-up
Thank you tina!!!
-- Newbies need extra loven......... "tina" wrote: these newsgroups are for the FREE exchange of ideas, information, and assistance. this is absolutely NOT the place to troll for business, such postings are not welcome, and they make such a bad impression that it can only hurt your reputation in the Access community. if you want to post actual advice and assistance here in the newsgroups for all to benefit from, or post questions of your own, then your participation will be welcomed. PACALA wrote in message ... NO PROBLEMS, CONTACT ME... -- PACALA JAN [ACCESS DEVELOPER] SEND 10$ TO... ACCOUNT: SK31 1100 0000 0026 1674 0428 SwiftCode: TATRSKBX Tatra banka as,Hodzovo nam.3, 811 06 Bratislava SKYPE: PACALA.BA1 "Chad" wrote: Hello, I have a file named song1.wav and its in a folder named Songs. How do I have my database play this song at startup. I move my database to and from work so the file path wont be the same but the folder "Songs" is always with the database. I have found the code below and it works but its pointing to windows media folder ect. Here is the code: Module: Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Public Sub PlaySound(strSound) Call sndPlaySound32(strSound, 0) End Sub On load event of my opening form: Call PlaySound("C:\Windows\Media\Whoosh.wav") Thanks!!! -- Newbies need extra loven......... |
#16
|
|||
|
|||
Play .wav file at DB start-up
Ok I figured it out! Here is what I did incase someone needs to do the same
thing. First create a folder named "AccessSounds" and put your .wav files in it that your going to use. Then create a module and name it ModPlaySound: Option Compare Database Option Explicit Const SND_ASYNC = (1) Const SND_NODEFAULT = (2) Declare Function sndplaysound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long ' FROM: http://www.techonthenet.com/access/q...s/play_wav.php Public Sub API_PlaySound(pWavFile As String) Dim LResult As Long 'Make a Windows API call to play a wav file LResult = sndplaysound(pWavFile, SND_NODEFAULT + SND_ASYNC) End Sub Then in your on click event of a button or wherever you are going to have the sound play use this line of code: API_PlaySound CurrentProject.Path & "\AccessSounds\sm_click.wav" It finds the curent project path and the folder "AccessSounds" and the .wav file you want to use.... -- Newbies need extra loven......... |
#17
|
|||
|
|||
Play .wav file at DB start-up
I think you may be over complecating this whole thing. All you want to do is
play a quite tune - right. Why not just ensure that the wav file is on your c drive in a folder containg the db and the wav. You say you have a folder - RejectSteelBarCodes - just copy the wav file into this and it should work. If this is not an option then just make sure that the wav file is on the c drive of the front ends - where used. It really isn't that complecated -- Wayne Manchester, England. "Chad" wrote: Yes that is the obvious answer! But, What if I move my databse from point A to point B all the time? Now im going to have to change the path on every button in my datbase to wherever the sound file resides Right? Thanks! -- Newbies need extra loven......... "Wayne-I-M" wrote: Hi The obvious answer is to copy the WAV file into a folder that also holds the Database. Would this be a problem. -- Wayne Manchester, England. "Chad" wrote: Wayne, I really appreciate the well expalined post but I understand how to make a module and where to put the code and how to find the path. My problem is that I move that database around and the sound file wont be in the same place as my home PC and work PC's. I wanted to do something as to where it finds the path for example im using this in a report to bring up pictures from a folder named RejectSteelBarCodes and this forlder always stays with my DB. How would I incorporate something like this but use a folder named Sounds to find the .wav file I am wanting? Oh and how about a delicious cookie baked fresh from the oven instead of the cake....Thanks! strPath = CurrentProject.Path & "\RejectSteelBarCodes\" strDir = Dir(strPath) -- Newbies need extra loven......... "Wayne-I-M" wrote: Hi Chad Playing a sound on various events in/on a form is quite simple (IF you know how). So 1st can we agree on my price. I never charge less than one absolutely huge cream cake. You can send this to me at Wayne-i-m c/o the British Post Office, England. I am sure it will arrive sooner or later. Oh if a cream cake is too much I will let you negotiate me down but no lower than a jam donut. You say you have looked around for some help and can’t understand it – me too, some of it, so don’t worry nothing is clear “until you get it, only then is it simple. If you have a look a the module on Allan Browns site http://allenbrowne.com You will it looks like this Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function So – to use this - do this In your access database you will have (on the left of the screen) choices of Tables Queries Forms Reports Pages Macros Modules Select Modules Select New You will arrive at a screen with Option Compare Database Cut and paste Allan’s code (paste just below Option Compare Database) it will now look like this Option Compare Database Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _ (ByVal filename As String, ByVal snd_async As Long) As Long ___________________________________________ Function PlaySound(sWavFile As String) ' Purpose: Plays a sound. ' Argument: the full path and file name. If apisndPlaySound(sWavFile, 1) = 0 Then MsgBox "The Sound Did Not Play!" End If End Function I drew the line in the code above as that is what you will see . Save this as whatever you want (but something that makes sense to you AND more importantly anyone else who may, in the future, work on the programming) Next Open your form in design view Right click the form area outside the detail section (the grey area) Select properties Select the Event Column Right click the OnLoad row Select Build (…) Select Code You will see this Private Sub Form_Load() End Sub You need to write only one line of code (like this) PlaySound (Path to WAV file) It will look something like (but not exactly like) this Private Sub Form_Load() PlaySound ("C:\WINDOWS\Media\chord.wav") End Sub OK up to now I hope. You MUST know the full path of the WAV. You can get it by clicking Start Run Browse (Select all files in the file type box) Navigate to your WAV file and select it. Click run Cut the path out of the run box and paste it into the code between the ( ) Hey-presto Hope this helps -- Wayne Manchester, England. "Chad" wrote: PACALA, The discussion Group isn’t a place to do business it’s a place to help people! I think this is very unprofessional.... Newbies need extra loven......... "PACALA" wrote: NO PROBLEMS, CONTACT ME... -- PACALA JAN [ACCESS DEVELOPER] SEND 10$ TO... ACCOUNT: SK31 1100 0000 0026 1674 0428 SwiftCode: TATRSKBX Tatra banka as,Hodzovo nam.3, 811 06 Bratislava SKYPE: PACALA.BA1 "Chad" wrote: Hello, I have a file named song1.wav and its in a folder named Songs. How do I have my database play this song at startup. I move my database to and from work so the file path wont be the same but the folder "Songs" is always with the database. I have found the code below and it works but its pointing to windows media folder ect. Here is the code: Module: Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Public Sub PlaySound(strSound) Call sndPlaySound32(strSound, 0) End Sub On load event of my opening form: Call PlaySound("C:\Windows\Media\Whoosh.wav") Thanks!!! -- Newbies need extra loven......... |
#18
|
|||
|
|||
Play .wav file at DB start-up
On Sun, 8 Jul 2007 08:38:03 -0700, Chad
wrote: Newbies need extra loven......... If only the lawyers could practice this. |
|
Thread Tools | |
Display Modes | |
|
|