Hey there,
I'm having problems with my data entry form and a button that performs simple VBA code. What I want is a button that saves the record, jumps back to the first tab of a tab control item, clears all the data and and adds a new entry.
I have used this:
Code:
Private Sub SaveBtn_Click()
If base_data = True And vacc_data = True And si_data = True And form_data = True Then
On Error Resume Next
DoCmd.RunCommand accCmdSaveRecord
DoCmd.RunCommand accCmdRecordsGoToNew
Me.tabctrl_main.Pages(0).SetFocus
base_data = False
vacc_data = False
si_data = False
form_data = False
Else
MsgBox ("Please enter all required data!")
End If
The boolean variables base_data .. etc. are set to true after pressing next on the first, second and so on tab in order to make sure that all data has been entered. The command does save records but does not clear all the text boxes and does not add a new entry in order to proceed and enter the next one.
What am I missing?
Should I also change the error handling to a message box in case the saving has been cancelled? Is there any way to get a message box to pop up in case the data has been successfully saved?
Thanks in advance!
Octavio