Private Sub bDone_Click()
lstFirst.RowSource = "qAddNewClientForTest"
lstFirst.Requery
If lstFirst.ListCount > 0 Then
Command20.Visible = True
count1 = lstFirst.ListCount
lstFirst.Visible = True
lblclients.Visible = True
answer1 = MsgBox("Attention:" & vbNewLine & vbNewLine & "A Learner exists in the database matching these details, select OK to verify if this is the you are looking for." & vbNewLine & vbNewLine & "If you have already verified this and would like add a new client based on these details please select cancel.", vbOKCancel, "Warning")
If answer1 = vbOK Then Exit Sub
End If
If txtFirst <> "" And txtSurname <> "" And txtDOB <> "" Then
Else
answer = MsgBox("Please enter the clients first name, surname and date of birth before proceeding.", vbInformation)
Exit Sub
End If
Dim tempvar
'code here
'Forms!AddNewTest.Form.Dirty = False
DoCmd.OpenForm "Frontend" 'open frontend
Forms!frontend.Form.SetFocus 'set focus on front end
DoCmd.GoToRecord , frontend, acNewRec 'goto new record
Forms!frontend.FORENAME = Forms!addnewclientfortest.txtFirst 'auto-populate
Forms!frontend.SURNAME = Forms!addnewclientfortest.txtSurname 'auto-populate
Forms!frontend.DOB = Forms!addnewclientfortest.txtDOB 'auto-populate
tempid = Forms!frontend.ID 'set id
temprec = Forms!AddNewTest.Form.CurrentRecord
Forms!frontend.Form.SetFocus
DoCmd.Close
Forms!addnewclientfortest.Form.SetFocus
DoCmd.Close
Forms!AddNewTest.Form.SetFocus 'set focus on new test
DoCmd.Close
DoCmd.OpenForm "AddNewTest"
DoCmd.GoToRecord , AddNewTest, acGoTo, temprec
Forms!AddNewTest.txtID = tempid