Dear Friends,
I got a sample code to store pictures in MS Access Database. I found it in Si_the_geek's signature (http://www.vbforums.com/showthread.php?t=376767) In that sample, there is an imagebox to show the pictures. Now, I have created a database to store audio files similar to this project. But don't know how to open an audio file (here I don't know which control to put on the form instead of imagebox)?
The following is the code where I need help (the line is in BOLD)
VB Code:
Public Sub FillFields() If Not (rs.BOF And rs.EOF) Then txtDescription.Text = rs.Fields("Description") [B]Set Image1.DataSource = rs [/B] 'setting image1’s datasource Image1.DataField = "Picture" 'set its datafield. End If End Sub
Set Image1.DataSource = rs which control to be used in place of Image1.DataSource
Need help, please.
Please also check the following code:
MargaretVB Code:
Private Sub cmdAdd_Click() Dim bytData() As Byte Dim strDescription As String On Error GoTo err With dlgAdd .Filter = "Audio Files (*.dat, *.wma)|*.dat;*.wma" .DialogTitle = "Select Audio File" .ShowOpen Open .FileName For Binary As #1 ReDim bytData(FileLen(.FileName)) End With Get #1, , bytData Close #1 strDescription = InputBox("Enter description.", "New Audio File") With rs .AddNew .Fields("Description") = strDescription 'adding record to db [B] .Fields("Audio").AppendChunk bytData [/B] 'adding the audio to the db .Update End With FillFields Exit Sub err: If err.Number = 32755 Then Else MsgBox err.Description err.Clear End If End Sub




Reply With Quote