text box value can not be obtaines unless set focus error 2185-

G

Guest

I am trying to transfer data from one text box to another and I have come
accress error runtime 2185, - you cant reference a propetry or method for a
control unless it has a focus.

please help me to resolve this issue.
Private Sub Command14_Click()
CurrData = Form_frmDSales.[Date].Text
If Trim$(CurrData) = "" Then
NewDate = Form_frmDSales.[Text12].Text
Form_frmDSales.[Date].Text = NewDate
End If

End Sub
 
D

Dirk Goldgar

Rookie said:
I am trying to transfer data from one text box to another and I have
come accress error runtime 2185, - you cant reference a propetry or
method for a control unless it has a focus.

please help me to resolve this issue.
Private Sub Command14_Click()
CurrData = Form_frmDSales.[Date].Text
If Trim$(CurrData) = "" Then
NewDate = Form_frmDSales.[Text12].Text
Form_frmDSales.[Date].Text = NewDate
End If

End Sub

Don't use the Text property; use the Value property instead. The Value
property is the default property of a text box, and it is always
available, while the Text property is only accessible when the control
has the focus. This is different in Access from in VB, because Access
forms and controls are different from VB forms and controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top