By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,313 Members | 2,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,313 IT Pros & Developers. It's quick & easy.

hours and i still can't do it

P: n/a
in a form:
how do you automatically update a textbox after u've clicked a value
in combo box with the value matching in the same row.

eg. say you selected a name in the combo box, it will automatically
update two text boxes with matching addresses and birthdays from the
same row.
here's a rough sample code i've tried to implement which doesn't work

text4.value = "select distinctrow cables from [pricing]" _
& "Where rating = [forms]![pricing]![rating]"

i've spent hours. and tried different other things like on change etc.
still can;t get it. smart it dudes out there please help!

thanks
Mike
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
There are a couple of ways.

1) You could include these 2 values in the Row Source of the combobox. Place
then in columns that have a width of 0". In the textboxes, you would set an
equation that refers to the column of the combobox.

Example:
=cboMyCombo.Column(1)

The column number is zero based, so the first column is 0, the second is 1,
etc.

2) You could use a DLookup function in the textboxes to lookup the data in a
table using a unique value from one of the columns in the combobox. You
would need to use this option if the desired data is not available in the
recordset that the row source comes from. This "unique value" would probably
be the PersonID or similar field.

=DLookup("Birthday", "tblBirthdays", "PersonID=" & cboMyCombo.Column(0))

--
Wayne Morgan
Microsoft Access MVP
"Michael La" <ni***********@yahoo.com> wrote in message
news:81*************************@posting.google.co m...
in a form:
how do you automatically update a textbox after u've clicked a value
in combo box with the value matching in the same row.

eg. say you selected a name in the combo box, it will automatically
update two text boxes with matching addresses and birthdays from the
same row.
here's a rough sample code i've tried to implement which doesn't work

text4.value = "select distinctrow cables from [pricing]" _
& "Where rating = [forms]![pricing]![rating]"

i've spent hours. and tried different other things like on change etc.
still can;t get it. smart it dudes out there please help!

thanks
Mike

Nov 12 '05 #2

P: n/a
Hi Wayne,

I've sometimes had trouble referring to a Combo box's columns directly from
the text box's Control Source.

So I usually use the combo box's AfterUpdate event to set the Text box
value.

e.g.
Private Sub cboAddressList_AfterUpdate()
txtAddress = cboAddressList.Column(1)
txtTown = cboAddressList.Column(2)
End Sub

Format the two text boxes so it's clear to the user that they can't be
updated - it'll save support calls!

It always works for me.

Andrew

"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:OI******************@newssvr33.news.prodigy.c om...
There are a couple of ways.

1) You could include these 2 values in the Row Source of the combobox. Place then in columns that have a width of 0". In the textboxes, you would set an equation that refers to the column of the combobox.

Example:
=cboMyCombo.Column(1)

The column number is zero based, so the first column is 0, the second is 1, etc.

2) You could use a DLookup function in the textboxes to lookup the data in a table using a unique value from one of the columns in the combobox. You
would need to use this option if the desired data is not available in the
recordset that the row source comes from. This "unique value" would probably be the PersonID or similar field.

=DLookup("Birthday", "tblBirthdays", "PersonID=" & cboMyCombo.Column(0))

--
Wayne Morgan
Microsoft Access MVP
"Michael La" <ni***********@yahoo.com> wrote in message
news:81*************************@posting.google.co m...
in a form:
how do you automatically update a textbox after u've clicked a value
in combo box with the value matching in the same row.

eg. say you selected a name in the combo box, it will automatically
update two text boxes with matching addresses and birthdays from the
same row.
here's a rough sample code i've tried to implement which doesn't work

text4.value = "select distinctrow cables from [pricing]" _
& "Where rating = [forms]![pricing]![rating]"

i've spent hours. and tried different other things like on change etc.
still can;t get it. smart it dudes out there please help!

thanks
Mike


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.