Results 1 to 9 of 9

Thread: Need help to ...audio files.

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    287

    Need help to ...audio files.

    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:
    1. Public Sub FillFields()
    2.     If Not (rs.BOF And rs.EOF) Then
    3.         txtDescription.Text = rs.Fields("Description")
    4.         [B]Set Image1.DataSource = rs [/B] 'setting image1’s datasource
    5.         Image1.DataField = "Picture" 'set its datafield.
    6.     End If
    7. 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:

    VB Code:
    1. Private Sub cmdAdd_Click()
    2.     Dim bytData() As Byte
    3.     Dim strDescription As String
    4.    
    5.     On Error GoTo err
    6.    
    7.     With dlgAdd
    8.         .Filter = "Audio Files (*.dat, *.wma)|*.dat;*.wma"
    9.         .DialogTitle = "Select Audio File"
    10.         .ShowOpen
    11.            
    12.         Open .FileName For Binary As #1
    13.         ReDim bytData(FileLen(.FileName))
    14.         End With
    15.      
    16.     Get #1, , bytData
    17.     Close #1
    18.    
    19.     strDescription = InputBox("Enter description.", "New Audio File")
    20.    
    21.     With rs
    22.         .AddNew
    23.         .Fields("Description") = strDescription  'adding record to db
    24.        [B] .Fields("Audio").AppendChunk bytData  [/B] 'adding the audio to the db
    25.         .Update
    26.     End With
    27.    
    28.     FillFields
    29.     Exit Sub
    30. err:
    31.     If err.Number = 32755 Then
    32.     Else
    33.         MsgBox err.Description
    34.         err.Clear
    35.     End If
    36. End Sub
    Margaret
    Last edited by Margaret; Dec 3rd, 2006 at 02:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width