Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    348
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Updating records in bulk from a form (access 2007)

    Have a form based on a table of seminars and seminar contents (in 1 table)
    Each seminar comprises of several contents.
    e.g. fire seminar has say escape, legislation, attack
    Given that a user can attend a seminar but only complete some or all of the contents we want to update the record via a form.
    Given then that the form can be ranged (filtered by selection) we would like to have a single check box/command to update all of the filtered "completed" check boxes.

    Is that sounding clear...and can it be done?

    TIA
    Alan

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Updating records in bulk from a form (access 2007)

    You could put a command button on the form with On Click code like this:

    Private Sub cmdUpdate_Click()
    Dim strSQL As String
    strSQL = "UPDATE [NameOfTheTable] SET Completed = True"
    If Me.FilterOn = True And Not Me.Filter = "" Then
    strSQL = strSQL & " WHERE " & Me.Filter
    End If
    DoCmd.RunSQL strSQL
    End Sub

    If you want to suppress the prompt to confirm the update, insert

    DoCmd.SetWarnings False

    before, and

    DoCmd.SetWarnings True

    after the DoCmd.RunSQL line.

  3. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    348
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Updating records in bulk from a form (access 2007)

    Cheers Hans, worked a treat on first day back from hols so cheered me up.
    Thanks
    Alan

Posting Permissions

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