Results 1 to 12 of 12
  1. #1
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60

    save new record problem

    I have image and some text data, I want to save them
    this is my button code for saving data:
    Code:
    On Error GoTo Err_saveandnewbtn_Click
    
    If IsNull(Me.nametxt.Value) Or IsNull(Me.usertxt.Value) Or IsNull(Me.passtxt.Value) Then
            MsgBox "fill all required fields"
            Me.nametxt.SetFocus
        
    Else
            Dim dbs As DAO.Database
            Dim rst As DAO.Recordset
                Set dbs = CurrentDb
                Set rst = dbs.OpenRecordset("users_tbl")
        
                rst.AddNew
                rst!fullname = Me.nametxt
                rst!user = Me.usertxt
                rst!pass = Me.passtxt
                rst!aclevel = Me.actxt
                rst!tel = Me.teltxt
                rst!img = Me.imgatch
                rst!nazer_part = Me.partcbo
                rst!des = Me.destxt
        
                rst.Update
    
                Me.nametxt = ""
                Me.partcbo = ""
                Me.usertxt = ""
                Me.passtxt = ""
                Me.teltxt = ""
                Me.imgatch = Nothing
                Me.destxt = ""
                Me.actxt = ""
                Me.nametxt.SetFocus
    End If
    Exit_saveandnewbtn_Click:
        Exit Sub
    Err_saveandnewbtn_Click:
        MsgBox Err.Description
        Resume Exit_saveandnewbtn_Click
    End Sub
    but when I click on button, it shows this error:
    object doesn't support this property or method

    how do I solve it? I know the problem is saving image, but how to solve it


    thanks

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Which line shows the error?
    Dale

  3. #3
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by rzw0wr View Post
    Which line shows the error?
    Dale
    this line
    rst!img = Me.imgatch
    imd data type in users_tbl is Attachment

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    What is imd data type?

  5. #5
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by rzw0wr View Post
    What is imd data type?
    excuse me
    I mean img data type

  6. #6
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    I don't think you can set an image to Nothing.
    Nothing is a reserved word.
    Take it out if you are not storing something in that field.

    This is just a quess.


    BTW. Add
    rst.Bookmark = .LastModified
    rst.Close
    Set rst = Nothing
    Dbs.close

    To you code after rst.Update.

    Dale

  7. #7
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by rzw0wr View Post
    I don't think you can set an image to Nothing.
    Nothing is a reserved word.
    Take it out if you are not storing something in that field.

    This is just a quess.


    BTW. Add
    rst.Bookmark = .LastModified
    rst.Close
    Set rst = Nothing
    Dbs.close

    To you code after rst.Update.

    Dale
    this code is for reseting form but it doesn't work
    also I want insert image to table when I click on button

  8. #8
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    my problem: how to save attachment with button into table
    please help me

  9. #9
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    msasan,
    You do need a button to save records.
    Where are the data coming from?
    Where are you getting the images.

    Dale

  10. #10
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    I attach my database please see and help me thanks
    db.zip

  11. #11
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    its better to say how to save attachment with DAO

  12. #12
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    please help me

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-08-2012, 08:40 AM
  2. Replies: 8
    Last Post: 09-27-2012, 11:12 AM
  3. save record
    By ashu.doc in forum Forms
    Replies: 4
    Last Post: 08-13-2012, 08:13 PM
  4. Replies: 4
    Last Post: 05-08-2012, 08:07 AM
  5. save record in 2 table
    By smahdih in forum Forms
    Replies: 2
    Last Post: 11-13-2011, 12:51 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
  •  
Other Forums: Microsoft Office Forums