Hi all
I have a continuous form which helps me keep track of which employees have passed which course. The way db has been structured, is the data from the continuous form gets saved in a temporary table, and only gets copied to actual table when the data is all OK i.e., all records have employee name, pass checkbox ticked, and certificated date entered.
What I am looking to do now is to validate the data when the user clicks on a SaveBtn (which runs an append query to copy all data from temporary table to actual table).
*NOTE: The reason I have not used Form_BeforeUpdate is because then I get an error message everytime I enter an employee's name, before even moving on to enter Certification Date*
The issue is, as long as the first record on the continuous form has all three controls (cboEmployee, chkPass, txtCertificationDate) filled in, the code fails to detect the remaining empty controls. The error msgbox only pops up if any of the controls in the first record are empty
Here is the code I have tried to use:
Thank you for your help
I have a continuous form which helps me keep track of which employees have passed which course. The way db has been structured, is the data from the continuous form gets saved in a temporary table, and only gets copied to actual table when the data is all OK i.e., all records have employee name, pass checkbox ticked, and certificated date entered.
What I am looking to do now is to validate the data when the user clicks on a SaveBtn (which runs an append query to copy all data from temporary table to actual table).
*NOTE: The reason I have not used Form_BeforeUpdate is because then I get an error message everytime I enter an employee's name, before even moving on to enter Certification Date*
The issue is, as long as the first record on the continuous form has all three controls (cboEmployee, chkPass, txtCertificationDate) filled in, the code fails to detect the remaining empty controls. The error msgbox only pops up if any of the controls in the first record are empty
Here is the code I have tried to use:
Code:
Dim ctrl as Control
For Each ctrl in Me.Section(0).Controls
If ctrl.tag = "Required" and Not (Me.NewRecord) Then
If Len(ctrl & vbNullString) = 0 and Not (Me.NewRecord) Then
MsgBox "Please fill " & ctrl.Name & " field before saving"
End If
Exit Sub
End If
Next ctrl
Docmd.OpenQuery "AppendQ"
Docmd.RunSQL "DELETE * FROM tempT "
Thank you for your help