Reference control unless focus problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that opens in the edit mode. I have an unbound image control
and a bound textbox with the path to the picture stored in the table. I want
the picture to display on each record as I scroll through the records. I have
the following code in the OnCurrent property of the image control (EditPic).
When I open the form I get the following message:

"You can't reference a property or method for a control unless the control
has the focus." How can I make this work correctly. Thank you.


Private Sub Form_Current()
Me.EditPic.Picture = Me.txtPicPath.Text
End Sub
 
Billy B said:
I have a form that opens in the edit mode. I have an unbound image control
and a bound textbox with the path to the picture stored in the table. I
want
the picture to display on each record as I scroll through the records. I
have
the following code in the OnCurrent property of the image control
(EditPic).
When I open the form I get the following message:

"You can't reference a property or method for a control unless the control
has the focus." How can I make this work correctly. Thank you.


Private Sub Form_Current()
Me.EditPic.Picture = Me.txtPicPath.Text
End Sub

Replace .Text with .Value

The text property of a control is only available when the control has the
focus, but the value property is available at all times.
 
Back
Top