I've spent all day on this, and can't see what I'm doing wrong. I've Googled and all I find have the same mistake, using .Text when they should use .Value. In this case, .Text is correct.
I tried wk = txtSearch.Text to no avail.
I tried txtSearch.SetFo cus before the use/assignment, also didn't work.
Obviously, the control has the focus, as I am typing in it, and want to monitor what is entered, as it is entered.
Trying to trick Access into doing my bidding, I tried
Now wk has the correct information, but the error occurs on the .SelStart = 255 statement. Leaving that out means that the entire string in the TextBox is selected. Not acceptable.
I copied the code for this control to a new database, new form with one control only. The code works. I copied the form to the new database, removed the RecordSource so I wouldn't have to duplicate the entire program. Works fine.
I don't want the code debugged, as the code works. I'm looking for ideas about what, on a form, might conflict with the "Got Focus". You know, like if the TextBox Backcolor is light blue, the moon is full, and the form is modal, there is trouble, so change on of these. That kind of idea.
OldBirdman
Code:
Private Sub txtSearch_Change() Dim wk As String wk = Me.txtSearch.Text 'This is the statement that gets Runtime Error '2185' . . . End Sub
I tried txtSearch.SetFo cus before the use/assignment, also didn't work.
Obviously, the control has the focus, as I am typing in it, and want to monitor what is entered, as it is entered.
Trying to trick Access into doing my bidding, I tried
Code:
Private Sub txtSearch_Change() Dim wk As String cmdExit.SetFocus wk = txtSearch txtSearch.SetFocus txtSearch.SelStart = 255 . . . End Sub
I copied the code for this control to a new database, new form with one control only. The code works. I copied the form to the new database, removed the RecordSource so I wouldn't have to duplicate the entire program. Works fine.
I don't want the code debugged, as the code works. I'm looking for ideas about what, on a form, might conflict with the "Got Focus". You know, like if the TextBox Backcolor is light blue, the moon is full, and the form is modal, there is trouble, so change on of these. That kind of idea.
OldBirdman
Comment