Kayleigh
Member
- Local time
- Today, 06:37
- Joined
- Sep 24, 2020
- Messages
- 706
I have two simple data entry forms. The first (DEfrmCovidTest) has a drop-down to all entries currently in table with option to go to second data entry form (DEfrmCovidConsent) to add new entries. This should requery onClose event so the dropdown now includes new entry but it is not working. This is my code for the onClose event:
What can I change?
Code:
Private Sub cmdClose_Click()
Dim intPressed As Variant
If (Me.Dirty = True) And (Me.NewRecord = False) Then
intPressed = MsgBox("Do you want to save changes?", vbYesNo + vbQuestion, gstrAppTitle)
If intPressed = 7 Then
Me.Undo
DoCmd.Close acForm, Me.Name
Forms!frmCovidRegister.Requery
Forms!frmDEfrmCovidTest.Requery
On Error Resume Next
Forms!frmDEfrmCovidTest.Visible = True
Exit Sub
Else
DoCmd.Save acForm, Me.Name
DoCmd.Close acForm, Me.Name
Forms!frmCovidRegister.Requery
Forms!frmDEfrmCovidTest.Requery
On Error Resume Next
Forms!frmDEfrmCovidTest.Visible = True
Exit Sub
End If
Else
DoCmd.Save acForm, Me.Name
DoCmd.Close acForm, Me.Name
On Error Resume Next
Forms!frmCovidRegister.Requery
Forms!frmDEfrmCovidTest.Requery
Forms!frmDEfrmCovidTest.Visible = True
End If
End Sub