Form mysteriously stops accepting VB changes to values in text boxes????

  • Thread starter Thread starter plh
  • Start date Start date
P

plh

Hello Everyone,
Something mysterious has happened to my form:
I had code to the following effect being executed as part of Form_Open:

With Me
...
...
.txtDIC.Value = intEDays
...
...
End With

Where .txtDIC is a bound text box control. Everything was fine until recently,
when I started getting the error message:

****************
Run-time error '2448'
You can't assign a value to this object
****************

I replaced it with...

strSQL = "UPDATE tblCustOrds SET DaysInCell = " & intEDays & " WHERE ID = " &
..OpenArgs
CurrentDb().Execute strSQL, dbFailOnError

....Which seems to work but the thing that bothers me is that the simpler method
of changing the table values worked before but now raises an error so something
has changed but I don't know what. Any ideas?
Thank You,
-plh
 
plh said:
Hello Everyone,
Something mysterious has happened to my form:
I had code to the following effect being executed as part of Form_Open:

With Me
...
...
.txtDIC.Value = intEDays
...
...
End With

Where .txtDIC is a bound text box control. Everything was fine until
recently,
when I started getting the error message:

****************
Run-time error '2448'
You can't assign a value to this object
****************

I replaced it with...

strSQL = "UPDATE tblCustOrds SET DaysInCell = " & intEDays & " WHERE ID =
" &
.OpenArgs
CurrentDb().Execute strSQL, dbFailOnError

...Which seems to work but the thing that bothers me is that the simpler
method
of changing the table values worked before but now raises an error so
something
has changed but I don't know what. Any ideas?
Thank You,
-plh

I don't know why it suddenly stopped working, but I'm surprised that it
worked at all. You can't reliably work with record source values in the Open
event of the form, because the record source hasn't necessarily been loaded.
That's what the Load event is for. Try putting your code in the Load event
and see if it works.

Carl Rapson
 
Back
Top