Hello Access-Programmers,
I am passing the variables varEmployerID and varContactID into a form. The variables are coming into the form fine. The If/Then catches them perfectly. The combo boxes fill flawlessly. As I step through the statement below all seems OK. varComboContact passes to cboContact and cboContact.Column(0) reads "2" as it should.
When it hits DoCmd.SearchForRecord, no error is generated but the record with ContactID #1 displays on the form, even though I can watch and see that cboContact.Column(0) equals "2". I tried Val(cboContact.Column(0)) to no avail.
Can anybody explain where I am going wrong?
Thank you for looking into this.
I am passing the variables varEmployerID and varContactID into a form. The variables are coming into the form fine. The If/Then catches them perfectly. The combo boxes fill flawlessly. As I step through the statement below all seems OK. varComboContact passes to cboContact and cboContact.Column(0) reads "2" as it should.
When it hits DoCmd.SearchForRecord, no error is generated but the record with ContactID #1 displays on the form, even though I can watch and see that cboContact.Column(0) equals "2". I tried Val(cboContact.Column(0)) to no avail.
Code:
If varEmployerID > 0 And varContactID = 0 Then
cboEmployer = varEmployerID
Me.Requery
cboContact = cboContact.ItemData(0)
DoCmd.SearchForRecord , "", acFirst, "[ContactID] = " & cboContact.Column(0)
End If
Can anybody explain where I am going wrong?
Thank you for looking into this.