You can't assign a value to this object (1 Viewer)

tpuhlig

Registered User.
Local time
Today, 01:26
Joined
Nov 20, 2009
Messages
15
I was working in my form and came up with this error.
"You can't assign a value to this object "

When I open up the form, it points me to the On load code.

Private Sub Form_Load()
txtCompletedBy = Environ("USERNAME")
End Sub

This was working fine. I removed the code to try to trouble shoot it.
If the code is removed, all I get on open is a blank form. I can't see anything. In designed mode, everything is there.

I can go back to my last backup but hopefully I can figure out the issue first. Last back up would need some updating.

Anyone with any ideals that could cause this?

I looked at some old post and it said to check the box type. It is text and the username is text.
 

delikedi

Registered User.
Local time
Today, 01:26
Joined
Apr 4, 2012
Messages
87
The only times I remember getting that error is when txtCompletedBy is has a control source, either as a calculated expression or as a field of underlying record source. ın other words, in design mode, txtCompletedBy should be filled with the word "Unbound".
 

veraloopy

Registered User.
Local time
Today, 09:26
Joined
Apr 10, 2009
Messages
139
Check your form settings, make sure Allow Edits is set to Yes and also check which section of the form you have placed all the fields in.
I accidentally put some text boxes in the Page Header/Footer which do not show in form view mode, make sure your text boxes are in the Detail section at least..
Finally, check the text box itself, make sure you havent put any data validation, input mask or date format, etc.
It may be better to create a new text box in the Detail section and temporarily change the code you already have to use this new text box instead - if it works then you know the old text box is the problem
 

tpuhlig

Registered User.
Local time
Today, 01:26
Joined
Nov 20, 2009
Messages
15
I do have it unbound because i need to collect that information. It was working fine for a week this way.

Ok, just to test it, I removed it and made it unbound. Still does the same thing.


The only times I remember getting that error is when txtCompletedBy is has a control source, either as a calculated expression or as a field of underlying record source. ın other words, in design mode, txtCompletedBy should be filled with the word "Unbound".
 

tpuhlig

Registered User.
Local time
Today, 01:26
Joined
Nov 20, 2009
Messages
15
Yes, checked it and it is set to allow edits when the form open in designed mode.

I have macro that sets it to no after the first insert. I did this because when a user is entering a record, if they scroll their mouse, it would go to a new record. Setting it to no after the first field is inserted into the table would make it stay on this record only.

This was working fine for days. I removed the marco to see if this was preventing it to load, it still does not load.



Check your form settings, make sure Allow Edits is set to Yes and also check which section of the form you have placed all the fields in.
I accidentally put some text boxes in the Page Header/Footer which do not show in form view mode, make sure your text boxes are in the Detail section at least..
Finally, check the text box itself, make sure you havent put any data validation, input mask or date format, etc.
It may be better to create a new text box in the Detail section and temporarily change the code you already have to use this new text box instead - if it works then you know the old text box is the problem
 

veraloopy

Registered User.
Local time
Today, 09:26
Joined
Apr 10, 2009
Messages
139
I have macro that sets it to no after the first insert. I did this because when a user is entering a record, if they scroll their mouse, it would go to a new record. Setting it to no after the first field is inserted into the table would make it stay on this record only

I found a way around this by going to the Form properties and on the 'Other' tab, change the 'Cycle' to Current Record. The default is All Records.
 

tpuhlig

Registered User.
Local time
Today, 01:26
Joined
Nov 20, 2009
Messages
15
I found a way around this by going to the Form properties and on the 'Other' tab, change the 'Cycle' to Current Record. The default is All Records.

I tried this in my backup form. It still shifts to a new record.
 

tpuhlig

Registered User.
Local time
Today, 01:26
Joined
Nov 20, 2009
Messages
15
Check your form settings, make sure Allow Edits is set to Yes ......

Ok, fixed it. I went line by line with my back up form to see what was different.

"Allow additions" was set to "NO"

My finger must have slipped?

Thanks everyone for your input!
Tom
 

Users who are viewing this thread

Top Bottom