Hi
I have a table in my Access 2007 database called Professional, which is linked to a Client table by its rClient field. The relationship from Client to Professional is one to many. There is a ProfessionalLead field in the Professional table that is bound to a checkbox. I'm trying to run a very simple query from the BeforeUpdate method of ProfessionalLead checkbox when it is clicked:
' Get all Professional Lead records for this client - should be no more than 1
Set dbs = CurrentDb
qryString = "SELECT * FROM Professional WHERE ProfessionalLead=-1 AND rClient=" & rClient.Value
Set rstProfLeads = dbs.OpenRecordset(qryString)
NumLeads = rstProfLeads.RecordCount
My hope is that rstProfLeads will contain only those records from Professional that are associated with the specified client and whose ProfessionalLead checkbox is checked. There are 3 records in Professional associated with the specified rClient, only one of which have ProfessionalLead checked, yet NumLeads receives a value of 3.
The really weird thing is that if I change the query to "SELECT * FROM Professional" (which should return all records in the table), NumLeads is always 1!
Any help greatly appreciated.
Patrick
I have a table in my Access 2007 database called Professional, which is linked to a Client table by its rClient field. The relationship from Client to Professional is one to many. There is a ProfessionalLead field in the Professional table that is bound to a checkbox. I'm trying to run a very simple query from the BeforeUpdate method of ProfessionalLead checkbox when it is clicked:
' Get all Professional Lead records for this client - should be no more than 1
Set dbs = CurrentDb
qryString = "SELECT * FROM Professional WHERE ProfessionalLead=-1 AND rClient=" & rClient.Value
Set rstProfLeads = dbs.OpenRecordset(qryString)
NumLeads = rstProfLeads.RecordCount
My hope is that rstProfLeads will contain only those records from Professional that are associated with the specified client and whose ProfessionalLead checkbox is checked. There are 3 records in Professional associated with the specified rClient, only one of which have ProfessionalLead checked, yet NumLeads receives a value of 3.
The really weird thing is that if I change the query to "SELECT * FROM Professional" (which should return all records in the table), NumLeads is always 1!
Any help greatly appreciated.
Patrick