P
Peter Marshall
I think I've seen this problem before but I can't remember the reason or
solution. I have a form (in add mode) whose record source is a single
table. For most fields on the form, the user will input data, but for a
couple of fields I am trying to populate them with the values of global
variables. I've got the global variables working (I can assign one to an
unbound text box on the form), but when I try to assign the variable value
to a bound text box, I get an error message that "Run-time error 2448: You
can't assign a value to this object". Here is my code:
Private Sub Form_Load()
If Me.OpenArgs = "Add" Then
DeclareDefaults 'This is a public sub that assigns values to
public variables
Me.txtDefLastName = defLastName 'assign global defLastName to the
unbound text box me.txtDefLastName. THIS WORKS.
Me.txtEmployeeLastName = defLastName 'TRY to assign global
defLastName to the bound text box Me.txtEmployeeLastName. ERRORS OUT.
End If
End Sub
Am I trying to do this too soon with the Form_Load. Where would be the
better event to tie this action to?
--
Peter Marshall
Manager Information Services
Ohio Coatings Company
740.859.5560 (w)
solution. I have a form (in add mode) whose record source is a single
table. For most fields on the form, the user will input data, but for a
couple of fields I am trying to populate them with the values of global
variables. I've got the global variables working (I can assign one to an
unbound text box on the form), but when I try to assign the variable value
to a bound text box, I get an error message that "Run-time error 2448: You
can't assign a value to this object". Here is my code:
Private Sub Form_Load()
If Me.OpenArgs = "Add" Then
DeclareDefaults 'This is a public sub that assigns values to
public variables
Me.txtDefLastName = defLastName 'assign global defLastName to the
unbound text box me.txtDefLastName. THIS WORKS.
Me.txtEmployeeLastName = defLastName 'TRY to assign global
defLastName to the bound text box Me.txtEmployeeLastName. ERRORS OUT.
End If
End Sub
Am I trying to do this too soon with the Form_Load. Where would be the
better event to tie this action to?
--
Peter Marshall
Manager Information Services
Ohio Coatings Company
740.859.5560 (w)