Run time error - You cant assign a value to this object (1 Viewer)

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
Hello All

I appear to be in run time error hell today...

Error: "Run time error '-2147352567(80020009)' You cant assign a value to this object" :confused:

Code:
Dim start_date As Date

    srcfrm = "FORMNAME"
   
    With Forms(srcfrm).Form
        .tab_form_parent.Visible = False
        .cmd_start_log.Visible = True
        .cmd_cancel_log.Visible = True
        .txt_name.BorderColor = 255
        .txt_name.BorderWidth = 2
        .txt_name.Locked = False
        .cbo_shift.BorderColor = 255
        .cbo_shift.BorderWidth = 2
        .cbo_shift.Locked = False
        .cbo_daynight.BorderColor = 255
        .cbo_daynight.BorderWidth = 2
        .cbo_daynight.Locked = False
        .txt_name.SetFocus
        .txt_operator_area.Value = theoperator_area
        .NavigationButtons = False
       [COLOR=Blue] .txt_log_area = log_area[/COLOR]
             
    End With
End Sub

Troublesome bit of code is highlighted in blue. If i hover over log_area it does appear to hold the correct text...

Thanks for any and all help :)
 
Last edited:

DCrake

Remembered
Local time
Today, 19:07
Joined
Jun 8, 2005
Messages
8,632
.txt_log_area = log_area

What type of control is this and what are you actually trying to copy to it?
 

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
this bit of code is setting up a form for first time use, before the user enters data

log_area is populated in another module, global variables.

Code:
Public Const log_area As String = "AREA"
 

vbaInet

AWF VIP
Local time
Today, 19:07
Joined
Jan 22, 2010
Messages
26,374
DCrake was asking, what type of control is txt_log_area?
 

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
Sorry, Missed abit. the control is a button on a form, "Create new..." that invokes this code.

Is that what you meant? I'm still a n00b with all this, sorry.
 

vbaInet

AWF VIP
Local time
Today, 19:07
Joined
Jan 22, 2010
Messages
26,374
A button doesn't have a Value property, it has a Caption property which is probably what you should be using.
 

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
Sorry, Not had enough coffee...

txt_log_area is a text box on the form that needs to be populated when a new record is created, hence this setup module. The module is invoked when the button is pushed.
 

vbaInet

AWF VIP
Local time
Today, 19:07
Joined
Jan 22, 2010
Messages
26,374
The textbox control is probably bound in that case.
 

SOS

Registered Lunatic
Local time
Today, 12:07
Joined
Aug 27, 2008
Messages
3,517
The textbox control is probably bound in that case.

Yeah, I was going to ask what the control source said (of that control). If it starts with = then it can't be set to a value.
 

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
no '=' on the control source...

it has worked in the past, Access 97 that is, only since migration to XP has it started being problematic
 

tech69

Registered User.
Local time
Today, 19:07
Joined
Jul 31, 2008
Messages
14
Turns out, Missing item from the table

control source gave it away!

thanks everyone, much appreciated.
 

SOS

Registered Lunatic
Local time
Today, 12:07
Joined
Aug 27, 2008
Messages
3,517
Good, glad you figured it out. :)
 

Users who are viewing this thread

Top Bottom