HillTJ
To train a dog, first know more than the dog..
- Local time
- Today, 08:42
- Joined
- Apr 1, 2019
- Messages
- 731
Friends, So I have a combobox 'ContactPurpose' on a bound continuous subform. I wish to populate the combobox with all records except when the user enters a new record, in which case I wish to restrict their selection to only 'Active' records. So, i have 2 select queries as below on the Form_Current event. One rowsource displays all records & the other displays the 'active' records only. My problem is that upon entering a new record, the first entered record does not display it's contents until the user 'loses focus' on that record.
I hope I've made sense & someone can shed some light on my issue. Cheers.
I hope I've made sense & someone can shed some light on my issue. Cheers.
Code:
Private Sub Form_Current()
Me.ContactPurpose.RowSourceType = "table/query"
If Me.NewRecord Then ' that is check that the rowsource record is active
Me.ContactPurpose.RowSource = "SELECT ContactPurposeID, ContactPurpose, RelationshipTypeID " & _
"FROM tluContactPurpose " & _
"WHERE ((RelationshipTypeID)=[txtgroup]) AND (([Active(Y/N)])=Yes) " & _
"ORDER BY ContactPurpose" '
'Me.ContactPurpose.Requery
Else ' show every previously selected record
Me.ContactPurpose.RowSource = "SELECT ContactPurposeID, ContactPurpose,RelationshipTypeID " & _
"FROM tluContactPurpose " & _
"WHERE ((RelationshipTypeID)=[txtgroup]) " & _
"ORDER BY ContactPurpose"
'Me.ContactPurpose.Requery
End If
End Sub