New and Need Some Help PLEASE!

I want to be able to select one or several records in a datagridview and update or change a specific column for each record selected. For example: A Customer database that has a date field for "work completed". I want to be able to select certain customers and update only the date "work Completed" for each customer selected to Todays date or any date I choose. How can I do this In VB express.

Thank You




Answer this question

New and Need Some Help PLEASE!

  • Rohit_Ghatol

    I'm very new at working with databases, although I have wrote some code to do what I've been asking but only in VB6. I can't figure how to make it work In VB express. In this example: The form has a datagrid showing all customer with their current "mowdate" as a field in the database. I want to select a date using the DTPicker value and Click an "Update" button to have the "mowdate" of each select record in the datagrid changed to the value of that DTPicker. Hope this explains a little more..

    Thanks

    Private Sub Command1_Click()
    SelectedDate = DTPicker1.Value
    If DataEnvironment1.rsPosting.State = adStateClosed Then
    DataEnvironment1.rsPosting.Open
    End If
    Dim holddate
    holddate = DTPicker1.Value
    DataEnvironment1.rsPosting.MoveFirst
    Dim selected As Boolean
    selected = False
    Dim varBmk As Variant
    For Each varBmk In DataGrid1.SelBookmarks
    DataEnvironment1.rsPosting.Bookmark = varBmk
    DataEnvironment1.rsPosting!mowdate = holddate
    selected = True
    Next

    If selected = False Then
    MsgBox "No Records Were Selected", vbOKOnly, "Select Records"
    Exit Sub
    End If
    DataEnvironment1.rsPosting.Update

    End Sub



  • Kris Kramer

    Hi and welcome to the forums. There are several methods to do what you are asking. It would help if you posted what code you have tried so far. Give us some additional information (code you have tried) and we can help you get going. For one thing, is the database you are using a current one, or one you are planning to build If this is your fist attempt at working with a database it helps to know how far you have gone with this.

    james

    aka:Trucker


  • New and Need Some Help PLEASE!