Wav file

coryt

Registered User.
Local time
Yesterday, 19:40
Joined
Jun 13, 2003
Messages
82
I was wondering if there was a way to play a short audio file when a certain record is found.

Basically I have a form with a text box, the user scanns a barcode into the textbox. If the db finds a corresponding record, I want it to play an audio file. I have this working with a message box instead of the audio file, but the user of this program keeps forgetting to look at the screen after each barcode is scanned.

Thanks in advance!
 
Option Compare Database
Option Explicit

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
Declare Function sndPlaySound Lib "WINMM.DLL" Alias "sndPlaySoundA" (ByVal IpszSoundName As String, ByVal uFlags As Long) As Long


Function PlaySound(sSoundFile As String)
Dim I As Long
If Len(Dir$(sSoundFile)) = 0 Then
Exit Function
End If
I = sndPlaySound(sSoundFile, SND_ASYNC)
If I = 0 Then
MsgBox "No sound"
End If
End Function
 
thanks Rich
 
Something simular...
Code:
Option Compare Database
Option Explicit
  
'PlayWaveFile
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal filename As String, ByVal snd_async As Long) As Long
    
Public Function PlayWaveFile(sWavFile As String)
    
    If apisndPlaySound(sWavFile, 1) = 0 Then
        'MsgBox "The Sound Did Not Play!"
    End If
    
End Function
    
Public Sub PlayWaveFile_Cord()
    
    Call PlayWaveFile("C:\Windows\Media\chord.wav")
    
End Sub
HTH
 
I could not get it to work... Here is my code:

Option Compare Database
Option Explicit

'PlayWaveFile
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal filename As String, ByVal snd_async As Long) As Long

Public Function PlayWaveFile(sWavFile As String)

If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If

End Function

Public Sub PlayWaveFile_huckle()

Call PlayWaveFile("C:\My Documents\huckle.wav")

End Sub


Private Sub txtBookletNumber_BeforeUpdate(Cancel As Integer)

If DCount("[BookletNumber]", "tblBookletNumber", "[BookletNumber] = """ & Me.txtBookletNumber & """") > 0 Then

MsgBox "Match found.", , "Match Found"

End If
End Sub
 
Just an observation, MS Text to Speech might be an option :)
 
coryt, exactly which part is not working? Can you call and play the wave file with your PlayWaveFile_huckle sub? Or, is your IF statement not working?
 

Users who are viewing this thread

Back
Top Bottom