Bind TextBox to a specific row in a query

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

Guest

I have a table containing several Projects and its Phases.

I made a query that Counts the total of projects in each phase:

Query_Projects_Phases

Phase CountOfPhase

Pre-project 1
Portfolio 45
Execution 7

Now I need to create TextBoxes in a Form to return the totals for each
phase. This means I need 3 TextBoxes.

One would be bound to the "Pre Project" CountOfPhase field from the query
(in this case 1);

the other would be bound to "Portfolio" CountOfPhase field from the query
(in this case 45) and so on...

I don't know how to do this.

Thanks for your time and help.
 
AntonioRio said:
I have a table containing several Projects and its Phases.

I made a query that Counts the total of projects in each phase:

Query_Projects_Phases

Phase CountOfPhase

Pre-project 1
Portfolio 45
Execution 7

Now I need to create TextBoxes in a Form to return the totals for each
phase. This means I need 3 TextBoxes.

One would be bound to the "Pre Project" CountOfPhase field from the query
(in this case 1);

the other would be bound to "Portfolio" CountOfPhase field from the query
(in this case 45) and so on...

I don't know how to do this.

Thanks for your time and help.

Is the form bound to the CountOfPhase query? If so, just select the query
field you want in the Control Source property for each textbox.

If not, you can use DLookUp in the textbox Control Source:

=DLookUp("[Pre-Project]","[CountOfPhase]")

Carl Rapson
 
Thanks Carl. But it still doesn't work. I get an "#Error" message.

I just read the Dlookup function definition and I guess the first input in
this function is the field name. In my case the field name is "Phase" and
"Pre Project" is one of the possible phases.

I tried something like

=DLookUp("[CountOfPhase]";"Value_Chain";"[Phase]=Pre-Project")

and it still doesn't work.

I want quantity (countofphase) of projects in the pre-project phase.


Can you still help me?



Carl Rapson said:
AntonioRio said:
I have a table containing several Projects and its Phases.

I made a query that Counts the total of projects in each phase:

Query_Projects_Phases

Phase CountOfPhase

Pre-project 1
Portfolio 45
Execution 7

Now I need to create TextBoxes in a Form to return the totals for each
phase. This means I need 3 TextBoxes.

One would be bound to the "Pre Project" CountOfPhase field from the query
(in this case 1);

the other would be bound to "Portfolio" CountOfPhase field from the query
(in this case 45) and so on...

I don't know how to do this.

Thanks for your time and help.

Is the form bound to the CountOfPhase query? If so, just select the query
field you want in the Control Source property for each textbox.

If not, you can use DLookUp in the textbox Control Source:

=DLookUp("[Pre-Project]","[CountOfPhase]")

Carl Rapson
 
Try this:

=DLookUp("[CountOfPhase]","[Query_Projects_Phases]","[Phase]='Pre-Project'")

Note the single quotes around the value Pre-Project.

Carl Rapson

AntonioRio said:
Thanks Carl. But it still doesn't work. I get an "#Error" message.

I just read the Dlookup function definition and I guess the first input in
this function is the field name. In my case the field name is "Phase" and
"Pre Project" is one of the possible phases.

I tried something like

=DLookUp("[CountOfPhase]";"Value_Chain";"[Phase]=Pre-Project")

and it still doesn't work.

I want quantity (countofphase) of projects in the pre-project phase.


Can you still help me?



Carl Rapson said:
AntonioRio said:
I have a table containing several Projects and its Phases.

I made a query that Counts the total of projects in each phase:

Query_Projects_Phases

Phase CountOfPhase

Pre-project 1
Portfolio 45
Execution 7

Now I need to create TextBoxes in a Form to return the totals for each
phase. This means I need 3 TextBoxes.

One would be bound to the "Pre Project" CountOfPhase field from the
query
(in this case 1);

the other would be bound to "Portfolio" CountOfPhase field from the
query
(in this case 45) and so on...

I don't know how to do this.

Thanks for your time and help.

Is the form bound to the CountOfPhase query? If so, just select the query
field you want in the Control Source property for each textbox.

If not, you can use DLookUp in the textbox Control Source:

=DLookUp("[Pre-Project]","[CountOfPhase]")

Carl Rapson
 
Carl, now it works perfectly! Thank you so much for your help. the name of
the query is Value_Chain. The only thing I had to do was to insert the single
quotes.

What a difference can a single quote make!

Antonio

Carl Rapson said:
Try this:

=DLookUp("[CountOfPhase]","[Query_Projects_Phases]","[Phase]='Pre-Project'")

Note the single quotes around the value Pre-Project.

Carl Rapson

AntonioRio said:
Thanks Carl. But it still doesn't work. I get an "#Error" message.

I just read the Dlookup function definition and I guess the first input in
this function is the field name. In my case the field name is "Phase" and
"Pre Project" is one of the possible phases.

I tried something like

=DLookUp("[CountOfPhase]";"Value_Chain";"[Phase]=Pre-Project")

and it still doesn't work.

I want quantity (countofphase) of projects in the pre-project phase.


Can you still help me?



Carl Rapson said:
I have a table containing several Projects and its Phases.

I made a query that Counts the total of projects in each phase:

Query_Projects_Phases

Phase CountOfPhase

Pre-project 1
Portfolio 45
Execution 7

Now I need to create TextBoxes in a Form to return the totals for each
phase. This means I need 3 TextBoxes.

One would be bound to the "Pre Project" CountOfPhase field from the
query
(in this case 1);

the other would be bound to "Portfolio" CountOfPhase field from the
query
(in this case 45) and so on...

I don't know how to do this.

Thanks for your time and help.


Is the form bound to the CountOfPhase query? If so, just select the query
field you want in the Control Source property for each textbox.

If not, you can use DLookUp in the textbox Control Source:

=DLookUp("[Pre-Project]","[CountOfPhase]")

Carl Rapson
 
Back
Top