Hi Everybody,
On my form I have a list box and a text box controls. When a user clicks an item in the list box I need the value to appear in the text box. So I put the the following piece of code into the Click event of the list box:
However when I run the form and click an item I get the following error mesage:
And the debugger points to the line
txb_myText.Text = str_value.
I suspect that the error might occur because I am trying to set the value of the text box while my list box holds the focus but I am not sure if this is the case since the value appears in the label okay (note two last lines of the code).
BTW, when I stop the debug I see the value in the text box despite the error message.
Can anyone help me fix this?
Thanks,
Alex
On my form I have a list box and a text box controls. When a user clicks an item in the list box I need the value to appear in the text box. So I put the the following piece of code into the Click event of the list box:
Code:
Private Sub lsb_myList_Click()
Dim str_value As String
...
txb_myText.SetFocus
txb_myText.Text = str_value
...
Form_myForm.lbl_myLabel.Caption = str_value
Form_myForm.Repaint
End Sub
However when I run the form and click an item I get the following error mesage:
Runtime error '2115'.
The macro or function set to the BeforeApdate or ValidationRule property for this field is preventing the form from saving the data into the field.
And the debugger points to the line
txb_myText.Text = str_value.
I suspect that the error might occur because I am trying to set the value of the text box while my list box holds the focus but I am not sure if this is the case since the value appears in the label okay (note two last lines of the code).
BTW, when I stop the debug I see the value in the text box despite the error message.
Can anyone help me fix this?
Thanks,
Alex