Unable to get text value

lution

Registered User.
Local time
Today, 12:19
Joined
Mar 21, 2007
Messages
114
Ok, weird one here. When I try to get the .text value from a combo as the user is changing the value, I get a "Control must have focus" error. But it should have focus, I'm editing the @#$@# thing.

Here's the only code on any of the control events:
Private Sub cmbDefendant_Change()

Debug.Print "text: " & Me.cmbDefendant.Text

End Sub

The list of possible values can be huge so I'm wanting to wait until the users typed 4 characters in the combo before I go get a the list of values from the database. I've done the same thing on another field on the form so I don't understand why its a problem on this one. I've tried changing the limit to list property for the control but that didn't help. On the other control I have it set to Yes to limit and it works fine.

What am I missing?
 
When things obviously aren't working as they should, as is the case here, you have to think about corruption. Controls can and do become corrupted, all the time, so the solution may be that the Combobox needs to be deleted and re-created.

Linq ;0)>
 
missinglinq is quite right there.

It would be interesting to know what control has the focus when this error occurs. Use this code and see what you get.
Code:
Private Sub cmbDefendant_Change()
On Error GoTo err_h

    Debug.Print "text: " & Me.cmbDefendant.Text

err_h_exit:
    Exit Sub
err_h:
    MsgBox "Control with focus: " & Me.ActiveControl.Name & vbNewLine & Err.Description
    Resume err_h_exit
End Sub
 
Created a new form from scratch and rebuilt the controls from scratch and added the on error code and it was telling me the cmbDefendant has focus which is the name of the control. I'm using this in the header section of a split form so I tried renaming the control to cmbDefendant2 in case I had another cmbDefendant on there somewhere but it still choked and told me cmbDefenant2 had focus.

I'll try creating a blank database and importing everything to see if that helps.

Appreciate the replies so far.
 
Ok, doesn't make any sense why this appeared to work on one combo but not the other but after I switched the split form to allow additions it is working.

Appreciate the help guys.
 

Users who are viewing this thread

Back
Top Bottom