Can't assign value to object

A

andrew3254

Hello,

I have a text box on a form which gets filled in when it is opened dependant
on who is logged on. The code I have works for other forms but not this one
and I am hitting a dead end trying to fix it. Here is my code:

If CurrentUser() = "User1" Then
Me.Division = "Division1"
Else
Me.Division = "Division2"
End If

I just keep getting run-time errors saying the value cannot be assigned.
The data is not an aggregate, it is a bound text box there is no default
value.
 
B

BruceM

Odd things can happen when a control and a field have the same name. I
don't know if that is the case, and I sort of doubt it will matter if it is,
but if they are the same name (and if the recordset can be updated, as
mentioned in another response) you could try changing the control name to
something like txtDivision. The code wouldn't have to change.
 
A

andrew3254

No the recordsource is the table. There is a subform on the form but that is
linked by a different field.
 
A

andrew3254

The recordset is updateable (I think) and I have tried changing the control
name and it still doesnt like it.

--
Thank you




BruceM said:
Odd things can happen when a control and a field have the same name. I
don't know if that is the case, and I sort of doubt it will matter if it is,
but if they are the same name (and if the recordset can be updated, as
mentioned in another response) you could try changing the control name to
something like txtDivision. The code wouldn't have to change.
 
A

andrew3254

I have managed a way round the value assignment.

I have made the text box unbound and then called an update query to update
the particular field in the table.


--
Thank you




andrew3254 said:
The recordset is updateable (I think) and I have tried changing the control
name and it still doesnt like it.
 
B

bhicks11 via AccessMonster.com

Congratulations!

Bonnie
http://www.dataplus-svc.com
I have managed a way round the value assignment.

I have made the text box unbound and then called an update query to update
the particular field in the table.
The recordset is updateable (I think) and I have tried changing the control
name and it still doesnt like it.
[quoted text clipped - 22 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top