Access 2007 Use SetValue macro to add date to multiple records RRS feed

  • Question

  • I have a form where the user first selects an ID in the main form, then all the measurement records for that ID appear in a subform. I have a command button set to run a SetValue macro to apply the date entered in a text box on the main form to the Date column in my subform. Currently, the macro only updates the record that is selected in the subform. Is there a way I can apply this macro to all records in the subform with an ID that matches the selected ID in the main form?

    I am new to Forms and not entirely comfortable using VBA. I tried setting a module to run an IF statement but I don't think my syntax was correct:

    IF [Forms]![MainForm]![SubForm]![ID] = [Forms]![MainForm]![ID] THEN DoCmd.RunMacro(mcrSetDate)

    • Edited by bb1028 Friday, December 23, 2016 10:13 PM
    Friday, December 23, 2016 10:12 PM

All replies