Lookup record on form with 2 combo boxes

S

SAC

I'm trying to lookup a record on a form with two combo boxes. It does this,
but also adds a record.

The afterupdate event on the second combo box triggers this code:

Dim rst As Recordset
Dim strSearchName As String
Dim strSearch As String

Set rst = Me.RecordsetClone
strSearchName = Me!cboEmpLU 'First cb
strSearch = Me!cboJobLU '2nd cb
rst.FindFirst "Empkey = " & strSearchName & " AND JobKey = " & strSearch

If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark

rst.Close

Any ideas on how to make it not add a record when it finds one?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top