textbox linking to another form

G

Guest

I have a text box in one form that is a subform of another. In my main form I
select a Chair Model from a combo box. The table that the chair model comes
from also has [Yards of Fabric] which I need automaticallly updated on my
subform. How do I go about doing this?

Thanks in advance.
Travis
 
P

Pat Hartman\(MVP\)

You don't need to actually store the [Yards of Fabric] in your order details
table unless you want the ability to over ride the value.

To just see the value but not store it, add the lookup table to the form's
RecordSource query. You can then bind a field to the yards field. Using
this technique, it is best to set the Locked property of the yards control
to Yes to prevent accidental updates.

To actually duplicate the value, add the yards field to the RowSource of the
combo you use to select ChairModel. The field can be hidden since it is not
relevant in the combo itself. Then in the combo's AfterUpdate event, you
add a single line of code:

Me.YardsOfFabric = Me.cboChairModel.Column(2)

Note that the .Column property is zero based which means that .Column(2) is
actually referring to the THIRD column. The first column is (0), the second
is (1), etc. So, adjust the column number accordingly.

PS - it is better technique to avoid special characters or embedded spaces
in your column names. You should also avoid function names such as "Date"
and "Year" and property names such as "Name" and "Text". There are complete
lists of reserved words available from the Microsoft knowledge base.
 
G

Guest

Hi Pat,
There are complete lists of reserved words available from the Microsoft
knowledge base.

True, but an easier and more up-to-date list, along with a free utility that
you can download to check your existing databases, is available here:

Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

Pat Hartman(MVP) said:
You don't need to actually store the [Yards of Fabric] in your order details
table unless you want the ability to over ride the value.

To just see the value but not store it, add the lookup table to the form's
RecordSource query. You can then bind a field to the yards field. Using
this technique, it is best to set the Locked property of the yards control
to Yes to prevent accidental updates.

To actually duplicate the value, add the yards field to the RowSource of the
combo you use to select ChairModel. The field can be hidden since it is not
relevant in the combo itself. Then in the combo's AfterUpdate event, you
add a single line of code:

Me.YardsOfFabric = Me.cboChairModel.Column(2)

Note that the .Column property is zero based which means that .Column(2) is
actually referring to the THIRD column. The first column is (0), the second
is (1), etc. So, adjust the column number accordingly.

PS - it is better technique to avoid special characters or embedded spaces
in your column names. You should also avoid function names such as "Date"
and "Year" and property names such as "Name" and "Text". There are complete
lists of reserved words available from the Microsoft knowledge base.
 
P

Pat Hartman\(MVP\)

Thanks for the link Tom.

Tom Wickerath said:
Hi Pat,
There are complete lists of reserved words available from the Microsoft
knowledge base.

True, but an easier and more up-to-date list, along with a free utility
that
you can download to check your existing databases, is available here:

Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

Pat Hartman(MVP) said:
You don't need to actually store the [Yards of Fabric] in your order
details
table unless you want the ability to over ride the value.

To just see the value but not store it, add the lookup table to the
form's
RecordSource query. You can then bind a field to the yards field. Using
this technique, it is best to set the Locked property of the yards
control
to Yes to prevent accidental updates.

To actually duplicate the value, add the yards field to the RowSource of
the
combo you use to select ChairModel. The field can be hidden since it is
not
relevant in the combo itself. Then in the combo's AfterUpdate event, you
add a single line of code:

Me.YardsOfFabric = Me.cboChairModel.Column(2)

Note that the .Column property is zero based which means that .Column(2)
is
actually referring to the THIRD column. The first column is (0), the
second
is (1), etc. So, adjust the column number accordingly.

PS - it is better technique to avoid special characters or embedded
spaces
in your column names. You should also avoid function names such as
"Date"
and "Year" and property names such as "Name" and "Text". There are
complete
lists of reserved words available from the Microsoft knowledge base.
 
G

Guest

How do I add the table to the record source query

Pat Hartman(MVP) said:
You don't need to actually store the [Yards of Fabric] in your order details
table unless you want the ability to over ride the value.

To just see the value but not store it, add the lookup table to the form's
RecordSource query. You can then bind a field to the yards field. Using
this technique, it is best to set the Locked property of the yards control
to Yes to prevent accidental updates.

To actually duplicate the value, add the yards field to the RowSource of the
combo you use to select ChairModel. The field can be hidden since it is not
relevant in the combo itself. Then in the combo's AfterUpdate event, you
add a single line of code:

Me.YardsOfFabric = Me.cboChairModel.Column(2)

Note that the .Column property is zero based which means that .Column(2) is
actually referring to the THIRD column. The first column is (0), the second
is (1), etc. So, adjust the column number accordingly.

PS - it is better technique to avoid special characters or embedded spaces
in your column names. You should also avoid function names such as "Date"
and "Year" and property names such as "Name" and "Text". There are complete
lists of reserved words available from the Microsoft knowledge base.


Tdahlman said:
I have a text box in one form that is a subform of another. In my main form
I
select a Chair Model from a combo box. The table that the chair model
comes
from also has [Yards of Fabric] which I need automaticallly updated on my
subform. How do I go about doing this?

Thanks in advance.
Travis
 
P

Pat Hartman\(MVP\)

Create a query that joins the two tables. You can use the build button at
the right edge of the RecordSource property.

Tdahlman said:
How do I add the table to the record source query

Pat Hartman(MVP) said:
You don't need to actually store the [Yards of Fabric] in your order
details
table unless you want the ability to over ride the value.

To just see the value but not store it, add the lookup table to the
form's
RecordSource query. You can then bind a field to the yards field. Using
this technique, it is best to set the Locked property of the yards
control
to Yes to prevent accidental updates.

To actually duplicate the value, add the yards field to the RowSource of
the
combo you use to select ChairModel. The field can be hidden since it is
not
relevant in the combo itself. Then in the combo's AfterUpdate event, you
add a single line of code:

Me.YardsOfFabric = Me.cboChairModel.Column(2)

Note that the .Column property is zero based which means that .Column(2)
is
actually referring to the THIRD column. The first column is (0), the
second
is (1), etc. So, adjust the column number accordingly.

PS - it is better technique to avoid special characters or embedded
spaces
in your column names. You should also avoid function names such as
"Date"
and "Year" and property names such as "Name" and "Text". There are
complete
lists of reserved words available from the Microsoft knowledge base.


Tdahlman said:
I have a text box in one form that is a subform of another. In my main
form
I
select a Chair Model from a combo box. The table that the chair model
comes
from also has [Yards of Fabric] which I need automaticallly updated on
my
subform. How do I go about doing this?

Thanks in advance.
Travis
 

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