Problems writing to a Textbox

back2basic

Registered User.
Local time
Today, 06:41
Joined
Feb 19, 2013
Messages
113
Can anyone help me figure out why am having problems writing to this textbox on my form?

Textbox name is: Last_Name
Text Control Source is :Last_Name
Line of code is :

Code:
Me.Last_Name = Me.Combo0.Column(4)

I get the following data in the textbox " #Name?"
and the error:

" You cannot assign a value to this object"
 
Can you explain a bit more what you're doing? If you've got a combo box on your form that returns the Last_Name in the fifth column, then that data presumably comes from another table (since you're using a combo box). So why then would you want to redundantly store the Last_Name again in this table (this table being the one that is used as the record of the form in question).

Tell us what we're missing here.
 
Can anyone help me figure out why am having problems writing to this textbox on my form?

Textbox name is: Last_Name
Text Control Source is :Last_Name
Line of code is :

Code:
Me.Last_Name = Me.Combo0.Column(4)

I get the following data in the textbox " #Name?"
and the error:

" You cannot assign a value to this object"

I think that the error is not about Last_Name, and instead is because Access cannot identify either Combo0, or Combo0.Column(4).two questions come to mind:
  1. Is the Combo Box named Combo0?
  2. Does Combo0 have 5 or more Parameters defined? You must remember that The Parameter count starts at 0.
-- Beetle

I think I understand what the Op is doing. There is a table (possibly an external link) that contains multiple pieces of information that are used by the Form. Selecting the control item retrieves a set of data that is to be updated on the Form.
 
Can you explain a bit more what you're doing? If you've got a combo box on your form that returns the Last_Name in the fifth column, then that data presumably comes from another table (since you're using a combo box). So why then would you want to redundantly store the Last_Name again in this table (this table being the one that is used as the record of the form in question).

Tell us what we're missing here.

I am relatively new with Access 2010 so bare with me in trying to explain:
The ComboBox is an unbound ComboBox called Combo0. I say it is unbound because there is no control source and the CB says "unbound". Why I dcon't know yet but it is doing "almost" what I want it to do. In any event, the row source of the CB is :
Code:
SELECT Material_Assignment.Date_allocated, Material_Assignment.Quantity_issued, Materials.Part_number, Materials.Serial_Number, Employees.Last, Employees.First FROM Employees INNER JOIN (Materials INNER JOIN Material_Assignment ON Materials.Material_ID = Material_Assignment.Material_ID) ON Employees.Employee_ID = Material_Assignment.Employee_ID; 
in is based on a query of the Table multiple tables

and as you can see the CB pulls it's data from multiple tables. What I am trying to do is the get the last_name from the the CB hence the code:

Code:
Me.Last_Name = Me.Combo0.Column(4) and display it on the from.

And display it on the form.
 
I am relatively new with Access 2010 so bare with me in trying to explain:
The ComboBox is an unbound ComboBox called Combo0. I say it is unbound because there is no control source and the CB says "unbound". Why I dcon't know yet but it is doing "almost" what I want it to do. In any event, the row source of the CB is :
Code:
SELECT Material_Assignment.Date_allocated, Material_Assignment.Quantity_issued, Materials.Part_number, Materials.Serial_Number, Employees.Last, Employees.First FROM Employees INNER JOIN (Materials INNER JOIN Material_Assignment ON Materials.Material_ID = Material_Assignment.Material_ID) ON Employees.Employee_ID = Material_Assignment.Employee_ID; 
in is based on a query of the Table multiple tables

and as you can see the CB pulls it's data from multiple tables. What I am trying to do is the get the last_name from the the CB hence the code:

Code:
Me.Last_Name = Me.Combo0.Column(4) and display it on the from.

And display it on the form.

I can see that the Source Query has 6 items selected and that the last name is item number 5, but that is not always enough. The Property Sheet for the Combo Box must also have at least 5 items defined in the Column Count.
 
Last edited:
I think that the error is not about Last_Name, and instead is because Access cannot identify either Combo0, or Combo0.Column(4).two questions come to mind:
  1. Is the Combo Box named Combo0? Yes
  2. Does Combo0 have 5 or more Parameters defined? You must remember that The Parameter count starts at 0. Yes it has 6. Please see the row source provided to Beetle in the response below for a snapshot of the CB rowsource
-- Beetle

I think I understand what the Op is doing. There is a table (possibly an external link) that contains multiple pieces of information that are used by the Form. Selecting the control item retrieves a set of data that is to be updated on the Form.
...........................................
 
I can see that the Source Query has 6 items selected and that the last name is item number 5, but that is not always enough. The Property Sheet for the Combo Box must also have at least 5 items defined in the Column Count.

Thank you but starting from 0, employee.last is the 4th item. The column count for this row source is 6, which is the correct amount starting from 1 as we should. Isn't that correct?
 
Re: [SOLVED]Problems writing to a Textbox

[SOLVED] After all day can't believe the forms record source was not pointing to the correct table. In fact it was not pointing to anything. I thought this automatic with the Wizard?
 

Users who are viewing this thread

Back
Top Bottom