Option Compare Database
Option Explicit
Private Const SND_ASYNC = 1
Private Declare Function sndPlaySound _
Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, _
ByVal UFlags As Long) As Long
Private Sub PlaySound(SoundFile As String)
sndPlaySound SoundFile, SND_ASYNC
End Sub
Private Function GetAppPath() As String
Dim strTemp As String
strTemp = CurrentDb.Name
GetAppPath = Left$(strTemp, Len(strTemp) - Len(Dir(strTemp)))
End Function
Private Sub Command0_Click()
PlaySound GetAppPath() & "test.wav"
End Sub