Entering data in a form

G

Guest

If a data field in a form is limited to a list, is there a way to get Access
to drop multiple fields of data in the form for that one record in the table?
For example, I have a table with name, address, phone, etc.. I also have a
form for survey data. Some of the fields of the survey form are limited to
the list from the names table. When I enter a survey into the form, I would
like to select the name and have it populate the remaining fields of address,
phone, etc.. Do I have to create a subform? If so, how do I link the
subform to populate the fields based upon the one field of information (like
the name)?
 
G

Guest

In the after update event of the combo insert the following for every field:

[fieldname] = me.[combobox].column(n)

where "n" is the column number in the combobox source. Check whether the
columns start at 0 or 1. I can't remember.
 
G

Guest

I do not understand this formula. Why do you enter the formula in every
field? And what is "me"? And which combo box are you referring to...the one
that has the first data selection? Or the one that is automatically being
populated?

I am not very good at the syntax in expressions, so forgive me if these
sound like stupid questions.

scubadiver said:
In the after update event of the combo insert the following for every field:

[fieldname] = me.[combobox].column(n)

where "n" is the column number in the combobox source. Check whether the
columns start at 0 or 1. I can't remember.


Bears&CubsFan said:
If a data field in a form is limited to a list, is there a way to get Access
to drop multiple fields of data in the form for that one record in the table?
For example, I have a table with name, address, phone, etc.. I also have a
form for survey data. Some of the fields of the survey form are limited to
the list from the names table. When I enter a survey into the form, I would
like to select the name and have it populate the remaining fields of address,
phone, etc.. Do I have to create a subform? If so, how do I link the
subform to populate the fields based upon the one field of information (like
the name)?
 
J

jahoobob via AccessMonster.com

Your "data field in a form is limited to a list" indicates you are using a
combobox or listbox to select names from a table. When you created this box
you selected the fields from the table to be displayed in this box and they
are in columns.
For this example the first column is Name, the second column is Address and
the third column is Phone.
You probably have column 1 as the Bound column so if Address is the second
column of the combobox (say named Combo1) and you want to display the Address
in a textbox called Add you would place the following in the After Update of
Combo1 as scubadiver said previously
me.[Add] = me.[Combo1].column(1)
explanation of the above:
me. says to look on the current object (form in this case) for a control
named Add and place what is in column 2 of the current record displayed in a
combobox named Combo1. It may appear that I have made a mistake in my column
numbers but Access VBA starts at the first column in a combobox and calls it
column(0) so the second column will be cloumn(1).
Hope this helps



Bears&CubsFan said:
I do not understand this formula. Why do you enter the formula in every
field? And what is "me"? And which combo box are you referring to...the one
that has the first data selection? Or the one that is automatically being
populated?

I am not very good at the syntax in expressions, so forgive me if these
sound like stupid questions.
In the after update event of the combo insert the following for every field:
[quoted text clipped - 12 lines]
 
G

Guest

Thank you for explaining it to me. I will try it out.

jahoobob via AccessMonster.com said:
Your "data field in a form is limited to a list" indicates you are using a
combobox or listbox to select names from a table. When you created this box
you selected the fields from the table to be displayed in this box and they
are in columns.
For this example the first column is Name, the second column is Address and
the third column is Phone.
You probably have column 1 as the Bound column so if Address is the second
column of the combobox (say named Combo1) and you want to display the Address
in a textbox called Add you would place the following in the After Update of
Combo1 as scubadiver said previously
me.[Add] = me.[Combo1].column(1)
explanation of the above:
me. says to look on the current object (form in this case) for a control
named Add and place what is in column 2 of the current record displayed in a
combobox named Combo1. It may appear that I have made a mistake in my column
numbers but Access VBA starts at the first column in a combobox and calls it
column(0) so the second column will be cloumn(1).
Hope this helps



Bears&CubsFan said:
I do not understand this formula. Why do you enter the formula in every
field? And what is "me"? And which combo box are you referring to...the one
that has the first data selection? Or the one that is automatically being
populated?

I am not very good at the syntax in expressions, so forgive me if these
sound like stupid questions.
In the after update event of the combo insert the following for every field:
[quoted text clipped - 12 lines]
subform to populate the fields based upon the one field of information (like
the name)?
 

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