Results 1 to 5 of 5

Thread: Why?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 1999
    Location
    Selma, NC, USA
    Posts
    25

    Post

    Can someone tell me what's wrong with this code and why it doesn't update the database?

    Private Sub cmdPicture_Click()
    Dim sFile As String
    Dim db As Database
    Dim rs As Recordset
    With dlgCommonDialog
    .DialogTitle = "Open"
    .CancelError = False
    .Filter = "BMP Files (*.BMP)|*.BMP"
    .ShowOpen
    sFile = .FileName
    End With
    frmMembers.Image1.Picture = LoadPicture(sFile)
    frmMembers.lblPicturePath.Caption = sFile
    Set db = OpenDatabase(App.Path & "\Members.mdb")
    Set rs = db.OpenRecordset("MemberInfo", dbOpenDynaset)
    rs.Edit
    rs!PicturePath = sFile
    Recordset("PicturePath") = Text1.Text
    rs.Update
    End Sub

    GiD

  2. #2
    Junior Member
    Join Date
    Nov 1999
    Posts
    26

    Post

    Looks alright but maybe its because in this line
    rs!PicturePath = sFile
    you've put a ! instead of a . try
    rs.PicturePath = sFile

    Hope this works



    ------------------
    Quadrex
    webmaster@quadrex.f9.co.uk
    Quadrex Programming


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 1999
    Location
    Selma, NC, USA
    Posts
    25

    Post

    Nope that didn't do it....can anyone out there help out? I just can't seem to get the database to update? I keep getting an error that says the database is readonly but its not. I've checked!

    GiD

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    Check the actual Read Attribute in the MDBs File Properties, could be it was left checked after a previous program crash?

    Another possibility is that you have the DB open in something else and it's opened Exclusively.

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  5. #5
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi,GiD.
    Do you use ODBC? I had the same problem and I found on microsoft support page solution, you have to provide all 4 parameters in OpenRecordset.
    Set rst=db.OpenRecordset _("TableName",dbOpenDynamic,0,dbOptimistic)
    NOTE: You must supply a zero (0) for the Option argument.

    Hope it help.
    Larisa

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