FindFirst on recordsetclone not working

poporacer

Registered User.
Local time
Yesterday, 23:57
Joined
Aug 30, 2007
Messages
136
I have a form that is bound to a table (tblBids). On the form is a combobox that is bound to a different table (a list of all employees and their employee ID) The employee id is a text field. When the user selects an employee in the combobox the form is set to the bookmark for the appropriate record. If the record does not exist in the tblBids, then one is added. I tried to use the FindFirst function to either pull up the correct record for editing or to add the new record. But the FindFirst function is not finding any records.
cmbId is the combobox with the Employee ID
EmpId is the field name containing the Employee ID

Here is the code I am using:
Code:
Dim rst As DAO.Recordset
Me.txtName = Me.cmbId.Column(1)
Set rst = Me.RecordsetClone
rst.FindFirst "EmpId = '" & Me.cmbId & "'"
If rst.NoMatch Then
    rst.AddNew
    rst!EmpId = cmbId
    rst.Update
    rst.Bookmark = rst.LastModified
End If
Me.Bookmark = rst.Bookmark
I think the problem is because the field EmpId contains numbers that are preceded by 2 spaces. (This is from a table that I have no control over...Bad design but it is what I have to work with) So an employee ID will look like " 1234"
 

Users who are viewing this thread

Back
Top Bottom