Question : rsFind first slow only if NoMatch

I have code attached where I use rsFind and it works fine if there is a match but it's fairly slow if there is no match.  Is there a way I could improve my code?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
Private Sub cboEvalDate_AfterUpdate()           ' Lookup by date
        Dim db As DAO.Database
        Dim qd As DAO.QueryDef
        Dim rs As DAO.Recordset
        Dim rsFind As DAO.Recordset
        Set db = CurrentDb()
        Set qd = db.QueryDefs!qryEvaluation
        qd.Parameters!ClientFileNo = txtClientFileNo
        qd.Parameters!WorkstationID = txtWorkstationID
        qd.Parameters!EvalDate = cboEvalDate.Text
        Set rs = qd.OpenRecordset
        Set rsFind = Me.RecordsetClone
>>>>> SLOW HERE IF NO MATCH
        rsFind.FindFirst "EvalDate = #" & Me.cboEvalDate & "# And ClientFileNo = " & Me.txtClientFileNo & " And WorkstationID = " & Me.txtWorkstationID
        If rsFind.NoMatch Then  'if can't find date entered, ask if they want to add new one
            Dim Msg, Style, Title, Response, MyString
            Msg = cboEvalDate.Value & " " & "does not exist for this client.  Would you like to add it?"
            Style = vbYesNo + vbDefaultButton1          'Define buttons.
            Title = "SOGoodwill"                            'Define title.
            Response = MsgBox(Msg, Style, Title)        'Display 'Last Updated on' message
            If Response = vbYes Then                    'If User chose Yes.
                bNewRevu = True
                Call AddEvalRcd
                bNewRevu = False
                cboName.Value = Null
                cboWorkstation.Value = Null
                cboEvalDate.Value = Null
                DoCmd.GoToControl "fsubEvalService"
            Else
                DoCmd.GoToControl "cboName"
                DoCmd.GoToControl "cboEvalDate"
                cboEvalDate.Value = Null
            End If
        Else
            Me.Bookmark = rsFind.Bookmark
            Set rsFind = Nothing
            Me.Refresh 'so newly added dates show in dropdown
            cboName = Null
            cboEvalDate.Value = Null
            dblClientFileNo = 0
            dblEvalID = 0
        End If

End Sub

Answer : rsFind first slow only if NoMatch

Try to use a NEW label every time. Like this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Do While i < countnotes 'This is better, even if it's not really needed
	Dim myLabel As New Label 'Maybe THIS solves your problem
	myLabel.Text = "Label " & i
	topposition += 3 'The shorter way ;-)
	myLabel.Location = New Point(5, topposition)
	'I think it's already False, but to be sure ...
	myLabel.AutoSize = False
	myLabel.Height = 24
	myLabel.Width = 176
	Panel1.Controls.Add(myLabel)
	i += 1 'The shorter way again ;-)
Loop
Random Solutions  
 
programming4us programming4us