Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't assign value to object

Status
Not open for further replies.

boblovesyousomuch

Programmer
Dec 2, 2003
27
GB
Hello everytime I try and run a command that assigns a value I get:

Run-time error: 2448

'You can't assign a value to this object, etc etc.'

I am sure you have seen this many times but I can't figure out what is wrong. My form is not read only.

I have included the code from one sub below.

Private Sub OptionDates_AfterUpdate()
Dim crtl As Control
Set crtl = Me![cboEndDate]
If Nz(Me![OptionDates], 1) = 2 Then
crtl.Visible = True
LabelTo.Visible = True
crtl.Value = Null
Else
crtl.Visible = False
LabelTo.Visible = False
crtl.Value = Null
End If
End Sub

Anyone any ideas, I doubt it is the code as I have seen the exact code work before?!

Thanks

Carl
 
Well for a start you are going about what you are doing a very tortuous route.

Convert it to:-

Private Sub OptionDates_AfterUpdate()


If Nz(OptionDates, 1) = 2 Then
cboEndDate.Visible = True
LabelTo.Visible = True
cboEndDate = Null
Else
cboEndDate.Visible = False
LabelTo.Visible = False
cboEndDate = Null
End If
End Sub


Only use
cboEndDate.Value = Null
IF you want the cboEndDate.AfterUpdate event to fire as a result of setting the value in code.

is cboEndDate bound or unbound ?

Change the code to the above and then let us know WHICH line causes the problems.







G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
The value is currently a unbound value. And is still giving the same error on the line:

cboEndDate = Null

I have no ideas what is happening here I have the same problem with another routine that is from a calendar control example too, I presum if I can sort this out I will be able to resolve the problem throughout.

Carl

 
Hi Carl!

As a guess, do you have the limit to list set to yes?

hth


Jeff Bridgham
bridgham@purdue.edu
 
No I haven't is it possible to post/email the database maybe then you will be able to see the problems with the calendar control too?

 
Hi!

If you want to email it to you can, but you will need to zip it first to get it by our security.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top