Unanswered: object required: setting the value for a public variable
My subform contains a fileld and a update button:
field name: txtcurrent_exch_rate1
When clicking on the button, the value in the text field is saved to the underlying table and I want the following to happen:
A public variable should be updated, as well as the value of an unbound text field on the parent form. (field name: txtCurrentExchRate2)
I have the following code:
On the declarations section of the main form (parent form):
Public gcurrExchRate As Currency
On the subform:
Private Sub cmdUpdateExchRate_Click()
On Error GoTo Err_cmdUpdateExchRate_Click
Re: object required: setting the value for a public variable
Originally posted by kedaniel
Set Me.Parent.txtCurrentExchRate2.Value = Me.txtcurrent_exch_rate1.Value
KenneyG is right, but didn't provide an explanation.
The Set keyword is only for setting an object reference, not for setting values. Also, Since Value is the default property of all of Access' bindable controls, you don't need to explicitly call the Value Property. Thus "MyTextBox.Value" and "MyTextBox" have the same result.