mainform text box value & retrieve info on subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, please help me with this. (enter a value(name) on a text box on the
mainform and retrieve all the information on a subform (with the same
name(not primary key) the could be many rows in that tabel).

When i am in the mainform and i select a
name(Table-eName) from a combo box and (either a button click or after i
selected name). i want a subform that would load the information from another
table(Table-wName). and on this subform i want only to show those file that
is related to the name that is selected on the mainform. And in both table
has the name filed. Also, I want that subform to be editable directly. (Ex.
If I want to change his hours(one of the filed on Table-wName) of the
subform. It has to be updated on the Table-wName.) I am unable to make the
subform to retrieve the information of the name that I selected on the
mainform. Please help me with this and if I need any vb-code please give me.
Thanks!
 
Thelee said:
Hi, please help me with this. (enter a value(name) on a text box on the
mainform and retrieve all the information on a subform (with the same
name(not primary key) the could be many rows in that tabel).

When i am in the mainform and i select a
name(Table-eName) from a combo box and (either a button click or after i
selected name). i want a subform that would load the information from another
table(Table-wName). and on this subform i want only to show those file that
is related to the name that is selected on the mainform. And in both table
has the name filed. Also, I want that subform to be editable directly. (Ex.
If I want to change his hours(one of the filed on Table-wName) of the
subform. It has to be updated on the Table-wName.) I am unable to make the
subform to retrieve the information of the name that I selected on the
mainform.


Try using the subform control's Link Master/Child properties
to do this. I think you want the Link Master to be the
combo box and the Link Child to the the name field.
 
Hi Marshall Barton, Thanks! i tried this and when i click on the subform
control's link master/child propeties. i get a error msg saying that "cant
build a link between unbound form". and when i looked up for help, i need to
have relationship between them. and they already has the name filed. i don't
know what goes wrong. please help me. thanks
 
Gee, I've never heard of that message before and have no
idea what it's talking about. I think you need to provide
more details.

The main form is unbound? If not, post its record source
table fields. or query.

What is the combo box's RowSource table fields or query?
What is the BoundColumn?

Also post the subform's record source table fields or query?

Somewhere in there I think you implied there may be more
forms involved with this. If so, please explain.

Does the subform control have anything in the
LinkMaster/Child properties? What is its SourceObject
property?

What version of Access are you using?
 
Hi Marshall, Thanks! it is working now. Thank you!
If you don’t mind, I have another problem,too. In the MainForm I select
a name(Table-name) and a subform that retrieve information from
Table-Project. There is a filed name Period (number 1-12). Now I made the
subform to retrive information for only Period (1). I want to create subform
to display each of the Period individually. Table-Project has name,period
filed and each row may be repeated none of them is primary keys. (ex. Using
Tab Control, having twelve tab and each have each period on). And it should
be able to display only those row with Period. I know we could do this but
how I don’t know. We could use tab or anything. I just want them to be
displaced in order. And One More, each subform has another filed Percentage.
And under each tab I want that text box to display total Percentag and if the
Percentage is above 100%, it should display a error msg. I know we could do
this, but I am new to this. Please help me with this,too. Thanks Marshall!
 
Thelee said:
If you don’t mind, I have another problem,too. In the MainForm I select
a name(Table-name) and a subform that retrieve information from
Table-Project. There is a filed name Period (number 1-12). Now I made the
subform to retrive information for only Period (1). I want to create subform
to display each of the Period individually. Table-Project has name,period
filed and each row may be repeated none of them is primary keys. (ex. Using
Tab Control, having twelve tab and each have each period on). And it should
be able to display only those row with Period. I know we could do this but
how I don’t know. We could use tab or anything. I just want them to be
displaced in order. And One More, each subform has another filed Percentage.
And under each tab I want that text box to display total Percentag and if the
Percentage is above 100%, it should display a error msg. I know we could do
this, but I am new to this. Please help me with this,too. Thanks Marshall!


Use the subform control's Link Master/Child fields to filter
the subform to a single period.

It sounds like you already have them set to the name field.
If so, change the Link Child to name, period.

It hink you said the tab control is used to select the
period on the main form. If so, I think you can set the
Link Master property to name,tabcontrolname.

The subform can have a text box named txtTotPcnt in its
header or footer section. Set it's control source
expression to =Sum(Percentage). With this in place the main
form can display the total by using another text box with
the expression =subformcontrol.txtTotPcnt
Use Conditional Formatting (Format menu) to set the
condition and color.
 
Hi Marshall Barton, Thanks! it is working now. thank you. now i have
something else that is not working. I have a total text box that calculate
total. and i want a pop-up msg showing if the total is greater then 100. i
tried and somehow it is not working. i wrote the code after/before update and
it is not showing me the msg. now i created a button to read the text and if
it is above 100, it would show the pop-up msg. i want that total text box to
triger this button, so it is possible to show the pop-up msg. but somehow
when i call the button function from the after/before update it is not
working. ( call functionName()) all three function are private. and i don't
know what is wrong with it. Any idea on how to do it. Thanks!
 
You can not synchronize an event procedure with control
expression evaluation. The VBA code in the event procedures
run at a much higher priority than automatic calculations.
Based on that reasoning, you can not check the control's
value and generate a message until some later time such as
the form's BeforeUpdate event. The alternative is to
calculate the total entirely in the event procedure, which
is usually a real pain.

A different idea is to display the total in a different
color based on its value using Conditional Formatting.
 
Thanks Marshall!

Marshall Barton said:
You can not synchronize an event procedure with control
expression evaluation. The VBA code in the event procedures
run at a much higher priority than automatic calculations.
Based on that reasoning, you can not check the control's
value and generate a message until some later time such as
the form's BeforeUpdate event. The alternative is to
calculate the total entirely in the event procedure, which
is usually a real pain.

A different idea is to display the total in a different
color based on its value using Conditional Formatting.
--
Marsh
MVP [MS Access]

Hi Marshall Barton, Thanks! it is working now. thank you. now i have
something else that is not working. I have a total text box that calculate
total. and i want a pop-up msg showing if the total is greater then 100. i
tried and somehow it is not working. i wrote the code after/before update and
it is not showing me the msg. now i created a button to read the text and if
it is above 100, it would show the pop-up msg. i want that total text box to
triger this button, so it is possible to show the pop-up msg. but somehow
when i call the button function from the after/before update it is not
working. ( call functionName()) all three function are private. and i don't
know what is wrong with it. Any idea on how to do it. Thanks!
 
Back
Top