Combobox Help

G

Guest

I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 
D

Douglas J Steele

If you've got a formula like that as the control source for a text box, then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub
 
G

Guest

I have 6 other fields in the combo box as well. I am some what new to this,
If you could assist in this matter, I would really appreciate it. So I need
to put that in the after update?

Douglas J Steele said:
If you've got a formula like that as the control source for a text box, then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 
G

Guest

Here are all of the fields,
=cboName.Column(1)
=cboName.Column(5)
=cboName.Column(2)
=cboName.Column(3)
=cboName.Column(4)

Thanks for the response!!!!


Douglas J Steele said:
If you've got a formula like that as the control source for a text box, then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 
G

Guest

Is there another way to pull the information? I thought the combo box would
assist with this... Well it did, I am just unsure on how to post in in the
work order table...

Douglas J Steele said:
If you've got a formula like that as the control source for a text box, then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 
D

Douglas J. Steele

Presumably you're showing what you set the ControlSource to for a number of
text boxes.

For each text box, change the control source to the name of the field where
the value should be stored.

In the AfterUpdate event, put code to assign the text box the value you
previous had as its control source.

In other words, if you had Text1 with a control source of =cboName.Column(1)
and Text2 with a control source of cboName.Column(5), you'd have

Private Sub cboName_AfterUpdate()

Me.Text1 = Me.cboName.Column(1)
Me.Text2 = Me.cboName.Column(5)
' and so on.

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Here are all of the fields,
=cboName.Column(1)
=cboName.Column(5)
=cboName.Column(2)
=cboName.Column(3)
=cboName.Column(4)

Thanks for the response!!!!


Douglas J Steele said:
If you've got a formula like that as the control source for a text box,
then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code
in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message news:[email protected]...
I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 
G

Guest

Do I need to put
Private Sub cboName_AfterUpdate()

Me.Text1 = Me.cboName.Column(1)
Me.Text2 = Me.cboName.Column(5)
' and so on.

End Sub
In each of the Text boxes in the After Update? I am getting a compile error.
Or do I need to put the Me.Text1 code in the combobox after update?

Sorry for being a pain. I do appreciate the assistance!!!!1

Douglas J. Steele said:
Presumably you're showing what you set the ControlSource to for a number of
text boxes.

For each text box, change the control source to the name of the field where
the value should be stored.

In the AfterUpdate event, put code to assign the text box the value you
previous had as its control source.

In other words, if you had Text1 with a control source of =cboName.Column(1)
and Text2 with a control source of cboName.Column(5), you'd have

Private Sub cboName_AfterUpdate()

Me.Text1 = Me.cboName.Column(1)
Me.Text2 = Me.cboName.Column(5)
' and so on.

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Here are all of the fields,
=cboName.Column(1)
=cboName.Column(5)
=cboName.Column(2)
=cboName.Column(3)
=cboName.Column(4)

Thanks for the response!!!!


Douglas J Steele said:
If you've got a formula like that as the control source for a text box,
then
it isn't bound to any field in the underlying recordset.

If you're sure you need to carry those fields in your table (odds are you
don't: you should base your reports on a query that join the necessary
tables together), bind the text box to the appropriate field in your
recordset (by setting the control source to the field name), and put code
in
the Combo Box's AfterUpdate event to populate the text box.

Private Sub cboName_AfterUpdate()

Me.MyTextBox = Me.cboName.Column(1)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message I have a form that when you select the customer it will populate varies
fields on a form. The problem is that it will not post to the table
required
for my reports. Can someone assist with this?

Here is an example of the code for the control source.
=[cboName].[Column](1)

Am I supposed to place this somewhere else?

Thanks,
Lee
 

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