MS Access Forms Back Button to Delete Input
Posted on 2014-12-02
I have a series of forms with a ‘Next’ and ‘Back’ button on them. Regarding the ‘Back Button…’ I was wondering if anyone could give me a code that, on click:
1. Opens the last form that was displayed and closes the current form
2. Deletes any input that was entered into the current form
Form1: Q: What is your name? Input Answer: Matt [Back] [Next]
Form2: Q: How old are you? Input Answer: 27 [Back] [Next]
Form3: Q: Where do you live? Input Answer: California [Back] [Next]
If I’m on Form3 and click the ‘Back’ button—the answer California should get deleted, Form2 should open and Form3 should close.
1. The flow of forms is not always in numeric order. It is important that the code opens The Last Form Displayed—not the previous form in terms of its numeric value
2. Forms and Data Inputted need to be bound to their appropriate/respective record-set, defined with the unique field: InterviewID
For example, the code for my ‘Next’ buttons is as follows:
Private Sub Command58_Click()
DoCmd.OpenForm "form5", , , "[InterviewID] = " & Me.InterviewID
DoCmd.Close acForm, "form6"
ErrTrap: MsgBox Err.Description