Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    345
    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. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 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.

  4. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    345
    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
  •