Cant assign a value to this object

D

Don McIntyre

[TechnologyGroup] = Me![cboTechnologyGroup].Column(1) This line gives
the error 'Cant assign a value to this object'

TechnologyGroup is Text
cboTechnologyGroup.Colmn(1) is also text

Related info on this Dbase.

I have 3 combo boxes with each of the first 2 being used as the
criteria for the following combi box, I then need to store the value
of the related column of the table. I have tried using Dlookup and
assigning this to the field TechnologyGroup with the same error
message although I can assign it to a variable
Just in case it is relevant, all of the fields and combi's are on a
subform. The final object is to store the users choice's in a related
sub record i.e

One Client but many transactions. I have the relationships working
fine on the tables and the only problem is with the combi's
Any ideas to resolve this problem?
Thanks in advance

Don
 
A

Albert D. Kallal

[TechnologyGroup] = Me![cboTechnologyGroup].Column(1) This line gives
the error 'Cant assign a value to this object'

TechnologyGroup is Text

It may be text...but what is the control bound to?

If the data source for the text box is a function, or some expression , then
it is NOT updatable (ie: it is not bound to a field in the underlying
table/query)

The same goes is the above is part of query...and the field it is bound to
is again not updateable.
 
D

Don McIntyre

Thanks for a fast response, the field it is bound to is a field named
TechnologyGroup which is in tblRecommendations, it is not an
expression Programme flow is as follows:
Ccomb 1 is unbound and looks up the data from table 1, the resultant
selection is passed to combi2 and this is used as the 'Where' part in
combi 2 and so on for combi 3.

Table 1 has 2 fields only ID (number) and the text description
Tables 2 and 3 have 3 fields ID (Number), Text description, ID2
(number)

Here is a simple view of the table structure and its relevance to each
other.

Table1
ID Descrip
1 Power
2 Energy

Table2
ID Descrip ID2
1 Gas 1
2 Elec 1
3 Oil 1
4 Joules 2
5 Kwh 2

and so on for table 3.
As can be seen if Power is selected in combi1 then 3 items will appear
as the choices in combi 2

Under is an extract of the code for combi1
'Sub Technology combo box

Private Sub cboTechnologyGroup_AfterUpdate()
With Me.cboMainTechnology
.Value = vbNullString
.RowSource = "SELECT * FROM tblBdgGroupL2 WHERE
IntTechGroup2_ID=" & Me.cboTechnologyGroup.Column(0)
.SetFocus
.Dropdown
End With

qaz = DLookup("[TechGroupL1]", "tblBdgGrouplL1", _
"[intTechGroup1_ID] = [cboTechnologyGroup]")

'[TechnologyGroup] = qaz
[TechnologyGroup] = Me![cboTechnologyGroup].Column(1)
Me![cboTechnologyGroup] = ""



End Sub

[TechnologyGroup] = Me![cboTechnologyGroup].Column(1) This line gives
the error 'Cant assign a value to this object'

TechnologyGroup is Text

It may be text...but what is the control bound to?

If the data source for the text box is a function, or some expression , then
it is NOT updatable (ie: it is not bound to a field in the underlying
table/query)

The same goes is the above is part of query...and the field it is bound to
is again not updateable.
 
A

Albert D. Kallal

Ok, then next thing I would check:
[TechnologyGroup] = Me![cboTechnologyGroup].Column(1)


Is not TechnologyGroup a long number type? Should you not be setting the
value of that field to a id, and not the text value? Try:
[TechnologyGroup] = Me![cboTechnologyGroup].Column(0)


Remember, the column function is zero based (0 gets first entry, 1 gets 2nd
entry) etc.
 
D

Don McIntyre

Albert,

I think you've got it! I have been at this for so long that I
couldn't see what was in front of me.
I'll put the code in for the rest of the combi's tomorrow and let you
know the results.

Thanks for your patience.
Don



Ok, then next thing I would check:
[TechnologyGroup] = Me![cboTechnologyGroup].Column(1)


Is not TechnologyGroup a long number type? Should you not be setting the
value of that field to a id, and not the text value? Try:
[TechnologyGroup] = Me![cboTechnologyGroup].Column(0)


Remember, the column function is zero based (0 gets first entry, 1 gets 2nd
entry) etc.
 
D

Don McIntyre

Albert,

Just an update on the above problem. You were right on with the
answer, I dony know why I didnt see it earlier.

Many thanks

Don
 

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