return the query result into field within same form

  • Thread starter Thread starter fathi_abuayyash
  • Start date Start date
F

fathi_abuayyash

Hello,
I have form that includes list of fields

period
plant
from_dt
to_date

returned_value

those mainly used to pars parameters into a query when i click the command
button. i want to return the query result into a text box within the same
form since the query will return only one value which is the sum. how this is
possible?

any help?

*new access developer*
 
fathi_abuayyash said:
I have form that includes list of fields

period
plant
from_dt
to_date

returned_value

those mainly used to pars parameters into a query when i click the command
button. i want to return the query result into a text box within the same
form since the query will return only one value which is the sum. how this is
possible?


I don't understand what you are trying to calculate, but it
sounds like you can use the DSum function in a text box's
control source expression to do it.

The expression might be something like:

=DSum("somefield", "sometable", "Plant=" & Me.Plant)
 
I am trying to show the result of the query on the same form.

the query returns the sum of the qty.
in order to return the sum the user has to input some parameters in the
fields
Period, plant, from_date, to_date.

as of now the programe works fine but query result open in another window
which i dont want, i would like to be able to return the query result in the
text field within the same form that has the parameters mentioned above.

let say i added one more field into the form called return_value once i fire
the button the programe will read the parameters and execute the query, the
result will display in the field return value instead of opening another
window for the result.

any help?
thanks





Marshall said:
I have form that includes list of fields
[quoted text clipped - 9 lines]
form since the query will return only one value which is the sum. how this is
possible?

I don't understand what you are trying to calculate, but it
sounds like you can use the DSum function in a text box's
control source expression to do it.

The expression might be something like:

=DSum("somefield", "sometable", "Plant=" & Me.Plant)
 
fathi_abuayyash via AccessMonster.com said:
I am trying to show the result of the query on the same form.

the query returns the sum of the qty.
in order to return the sum the user has to input some parameters in the
fields
Period, plant, from_date, to_date.

as of now the programe works fine but query result open in another window
which i dont want, i would like to be able to return the query result in the
text field within the same form that has the parameters mentioned above.

let say i added one more field into the form called return_value once i fire
the button the programe will read the parameters and execute the query, the
result will display in the field return value instead of opening another
window for the result.


If your query already does all the calculations, then you
can use DLookup to retrieve the result in a text box
control's control source expression:

=DLookup("queryfieldname", "nameofquery")
 
Marshall said:
I am trying to show the result of the query on the same form.
[quoted text clipped - 11 lines]
result will display in the field return value instead of opening another
window for the result.

If your query already does all the calculations, then you
can use DLookup to retrieve the result in a text box
control's control source expression:

=DLookup("queryfieldname", "nameofquery")
Thanks all
 
Back
Top