Access 2000 vs Access 2010 (1 Viewer)

fitzintx

New member
Local time
Yesterday, 18:23
Joined
Nov 30, 2012
Messages
8
All, I'm stepping back into coding after a 5 year layoff so bare with me. I'm working on some access code that was converted from 2000 to 2010. One field is a textbox and it's control source is the following...

=IIf([InternationalChk]=Yes,"Lease","County")

'InternationalChk' is the field in the recordset that is a yes/no in the database.

In the 2000 version, as soon as the user checks the checkbox the values change between Lease and County. There is no code that I can find that changes the values. In 2010, after the user checks the checkbox I have to exit out of this form and come back in. Ok, i'm thinking about this as I'm typing, the new version in 2010 is linking tables to SQL. Could there some sort of delay from the value changing in the database and for some reason the form is not seeing it until it loads again? Why would the 2000 version, just using Access, change the values immediately?

So I was trying to write some code when the checkbox is checked but I keep getting an error.. 'You can't assign a value to that object'

Sorry, to ramble on, so my questions are:
1) Why can't I assign a value to a textbox in my VBA code - me.countlease.text = 'lease (this is what throws the error you can't assign a value to that object
2) Why does the older version of Access change the values of the textbox and the new version does not if no code was changed.

Thanks for any help and tips in advance.
Kyle Fitzgerald
 

John Big Booty

AWF VIP
Local time
Today, 09:23
Joined
Aug 29, 2005
Messages
8,262
In the On Click event of the Check Box try;
Code:
If Me.InternationalChk = True Then
     Me.countlease = "Lease"
Else 
     Me.countlease = "County"
End If
 

fitzintx

New member
Local time
Yesterday, 18:23
Joined
Nov 30, 2012
Messages
8
I still get the error...

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:23
Joined
Jan 20, 2009
Messages
12,866
You need to remove the ControlSource of the textbox for John's code to work.
 

fitzintx

New member
Local time
Yesterday, 18:23
Joined
Nov 30, 2012
Messages
8
When I remove the controlsource from the textbox the code works and I don't get the error! So if I go this route then I'd have to go thru the code and add this IF statement as the Form Loads as well to set the value in the beginning, sound right?

Do we know why the values changed in the Access 2000 version but won't in the current 2010. Everything is set the same as far as the textboxes having the 'IIf' statement as the control source.
 

Users who are viewing this thread

Top Bottom