I have a form that is being used to create entries with different sequential fields. I'm currently using DLookup in order to do this, but I am running into some issues.
Me.txtProgramID.Value = DLookup("ProgramID", "tblMain", "Program = Forms!Form2!Combo.Value") + 1
Me.txtProgramNumber.Value = DLookup("Number", "tblMain", "Program = Forms!Form2!Combo.Value") + 1
Me.txtSequence2.Value = DLookup("Sequence2", "tblMain", "Program = Forms!Form2!Combo.Value") + 1
Me.txtSequence1.Value = DLookup("Sequence1", "tblMain", "Program = Forms!Form2!Combo.Value") + 1
There are four different values: ProgramID, ProgramNumber, Sequence1, and Sequence2. Everytime a new record is added, based on the contents of Combo, the contents of the new field should be the previous field + 1.
Lets say the contents of Combo is A and that the values for ProgramID, ProgramNumber, Sequence 1, and Sequence 2 are all 1. The new record for A should have them all as 2. The problem I'm having is that instead of DLookup finding the most recent entry, it is capturing the original, meaning that instead of having 1, 2, 3, 4, etc I have 1, 2, 2, 2.
Really what I need to know is how to make DLookup grab the most recent record in regards to the respective profiles.