I understand why I am getting this error, I just need to find a work
around for it. Here is what I'm trying to do: There is a textbox on
my form that OnClick will ask the user for a new value, I want to take
this value and update the textbox with this value. I can't use the
recordsource option on this textbox because the Form ControlSource is
constantly changing. Here is the code I'm using:
Dim MyResponse As String
Dim MyNewVal As Currency
Dim Salary As Currency
MyResponse = InputBox("Enter a value of 1 or 2" & Chr(13) & "1) Enter
New Hourly Wage" & Chr(13) & "2) Enter a Salary", "New Rate")
Select Case MyResponse
Case "1"
MyResponse = InputBox("Input your Hourly Rate", "New Rate")
If MyResponse <> "" Then
MyNewVal = MyResponse
lblRate.ControlSource = "=" & MyNewVal
lblRate.DefaultValue = MyNewVal
lblRate.Requery
End If
Case "2"
MyResponse = InputBox("Input a Salary", "Salary to Hourly")
If MyResponse <> "" Then
Salary = MyResponse
MyNewVal = CalcSalary(Salary)
lblRate.ControlSource = "=" & MyNewVal
lblRate.DefaultValue = MyNewVal
lblRate.Requery
End If
End Select
If MyResponse <> "" Then
Call cmdCalc_Click
End If
This code works but it does not save the new value. It will work while
the form is in Normal View, but if I go to design mode or close it all
together the next time I open the form it reverts back to the original
value I typed in the Design Mode for this textbox. I need to come up
with a work around to have this textbox updateable with a value that
will be saved in the form and shows up the next time I open this form.