Greetings, fellow Access programmers
I have a situation where i want to run and incremental search (can you even do that?) on the bound column of a combo box. I am using an option group to determine which query should be used to specify the row source in the combo box. Said differently, change the order in which the columns are displayed so that it also makes sense to the user by presenting it in a logical order. Everything is fine and dandy until I change the properties of the combo box in VBA. See my code below. I can't for the life of me understand how the Text property is there are no instructions for it. Is there how I circumvent this and keep the text the user types in in the combo box?
Please help! I've been on this for a week now and trying to find solutions to no avail.
Here is my code:
Code:
If Me.optSearchMethod = 1 Then
strSQL = "SELECT * FROM qrySearchByHospID WHERE qrySeachByHospID!txtPtHospID LIKE '" & Me.cboPatient.Text _
& "' AND qrySearchByHospID.txtLocationMnemonic = 'ICU';"
varCboBoxValue = Me.cboPatient.Value
Me.cboPatient.RowSource = strSQL
cboPatient.ColumnCount = 6
' Me.cboPatient.Text changes to "" after excecuting this instruction.
cboPatient.ColumnWidths = "4cm., 4cm., 4cm., 1cm., 1.5cm., 3cm.)"
Else
strSQL = "SELECT * FROM qrySearchBySurname WHERE qrySearchByHospID!txtPtSurname = LIKE '" & Me.cboPatient.Text _
& "' AND qrySeachByHospID!txtLocationMnemonic = 'ICU';"
Me.cboPatient.RowSource = strSQL
Me.cboPatient.ColumnCount = 6
' cboPatient.Text changes to "" after executing this instruction.
Me.cboPatient.ColumnWidths = "4cm., 4cm.,4cm., 1.5cm., 1cm., 3cm."
End If
Thanks in advance, and happy coding.