Hello world... I'm relatively new to access, but understand a bit. I'm trying to create a customer management dbase for the local council I work for, to make 50 or so colleagues lifes easier since the council is apparently skint and can't afford to buy one - we've been asking for about 10 years.
I have a form which I use to search for clients google-style when I hit a command button, (using surname etc), the query runs and produces the results in another form, and closes the original search form. If there are matching results, everything is fine, my query results form loads and the person appears. If there are no matching results, during the 'on open' event of the query results form I have a yes-no msgbox come up.
Clicking the Yes button re-directs me to a different form to enter a new client and closes the query results form. This works fine.
I'm trying to make the No button take the user back to the search window and ready to make another search, however when I click no it closes the query results form and just goes back to the dbase window with no open forms....
Can anyone help me with this code please?
Code:
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then
Select Case MsgBox("Do you want to add a new Client?", vbQuestion + vbYesNo, "NO CLIENTS FOUND")
Case vbYes
DoCmd.OpenForm "FrmNewClient", , , acFormAdd
DoCmd.Close acForm, Me.Name
Case vbNo
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "SearchF"
End Select
End If
End Sub