Results 1 to 3 of 3

Thread: Inserting and deleting records

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Lisbon, Portugal
    Posts
    69

    Question Inserting and deleting records

    Hi,

    Does anybody know how I can delete the selected row in a MSFlexGrid and how I can insert a new record?
    Rita Jaques

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Location
    State of Confusion
    Posts
    133
    Do it through the data control that is linked to the grid....

    Code:
    Private Sub Command1_Click()
      'Deletes the current record
      Data1.Recordset.Delete
      Data1.Refresh
    End Sub
    
    Private Sub Command2_Click()
      'Adds a new record
      With Data1.Recordset
        .AddNew
        .Fields("SomeFieldName").Value = "Whatever"
        .Fields("AnotherFieldName").Value = "Whatever Again"
        .Update
      End With
      Data1.Refresh
    End Sub
    "Don't take life too seriously, you'll never get out alive"
    from Van Wilder

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Lisbon, Portugal
    Posts
    69

    Unhappy

    Thanks, it is a good idea, but it gives the following error:

    Can't update. Database or object is read-only.

    I've checked the Read-only property in the data control and it is set to false. So, I don't know why I can't update it.
    Rita Jaques

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