How to put query result in the textbox of a form 5or in a dynamic report)??? HELP REQUIRED!!!

G

Guest

Hi

I've got a problem and I need help urgently. I'm using combo boxes to set up the criteria for my queries. Once specifying the required parameters in the combo boxes on my form, the query is automatically run coming up with the query result. What I am trying to do is to put the result of my query in a textbox present in the form. The problem is that I just can't manage to do that!!! I've already tried setting the control value of the textbook as the value of the query using the Expression Builder, but it isn't working! Can anyone PLEASE help me as soon as possible?

SECOND PROBLEM: I need to put in the results of my 7 queries in my dynamic report. I've succeded in running all the queries and getting results but I can't put the results neither in the report nor in the textbox present on the form. Thank you very much for replying in detail to my problem. I shall really apprecaite if anyone could just tell me how to put the result of my seven different queries in the dynamic report!!

Regards
Mike.
 
G

Guest

For the first problem use a list box instead of a textbox and set the rowsource = to your query

For the second question, are these queries related in any way? If so use a subreport (same button as subform on the control toolbox in the report design). Base the report on the first query. The wizard will help lead you through this. I'm not sure if there is a limit as to the number of subreports on a report or imbedding a subreport in a subreport.
 
V

Van T. Dinh

Q1. If you meant the Query returns only 1 row and you want a particular
column value (or it returns only 1 row / 1 column), you can use the
DLookUp() function as the ControlSource of the TextBox.

Note that Query returns a Recordset, in simple terms, like a matrix of
values even 1 row / 1 culumn. It doesn't return A VALUE and therefore you
cannot simply use the Query as the Control Source.

Q2. Same DLookUp() function.

--
HTH
Van T. Dinh
MVP (Access)





Clickoo said:
Hi,

I've got a problem and I need help urgently. I'm using combo boxes to set
up the criteria for my queries. Once specifying the required parameters in
the combo boxes on my form, the query is automatically run coming up with
the query result. What I am trying to do is to put the result of my query in
a textbox present in the form. The problem is that I just can't manage to do
that!!! I've already tried setting the control value of the textbook as the
value of the query using the Expression Builder, but it isn't working! Can
anyone PLEASE help me as soon as possible?
SECOND PROBLEM: I need to put in the results of my 7 queries in my dynamic
report. I've succeded in running all the queries and getting results but I
can't put the results neither in the report nor in the textbox present on
the form. Thank you very much for replying in detail to my problem. I shall
really apprecaite if anyone could just tell me how to put the result of my
seven different queries in the dynamic report!!!
 
G

Guest

Hi there

Thank you very much for helping me out

Can anyone please explain the DLOOKUP() function to me? I need to put my query result (single number) in a textbox. Eventually, I intend to put that result in a report. However I can't use Expression Builder to put the query result in either my textbox or my report.

I shall be very grateful if somebody could explain in detail the DLOOKUP() function to do all of the above things. People have asked me to use this function to do the actions mentioned above, but I just can't seem to do it

Regards
Mike.

----- Van T. Dinh wrote: ----

Q1. If you meant the Query returns only 1 row and you want a particula
column value (or it returns only 1 row / 1 column), you can use th
DLookUp() function as the ControlSource of the TextBox

Note that Query returns a Recordset, in simple terms, like a matrix o
values even 1 row / 1 culumn. It doesn't return A VALUE and therefore yo
cannot simply use the Query as the Control Source

Q2. Same DLookUp() function

-
HT
Van T. Din
MVP (Access





Clickoo said:
up the criteria for my queries. Once specifying the required parameters i
the combo boxes on my form, the query is automatically run coming up wit
the query result. What I am trying to do is to put the result of my query i
a textbox present in the form. The problem is that I just can't manage to d
that!!! I've already tried setting the control value of the textbook as th
value of the query using the Expression Builder, but it isn't working! Ca
anyone PLEASE help me as soon as possiblereport. I've succeded in running all the queries and getting results but
can't put the results neither in the report nor in the textbox present o
the form. Thank you very much for replying in detail to my problem. I shal
really apprecaite if anyone could just tell me how to put the result of m
seven different queries in the dynamic report!!
 
V

Van T. Dinh

Try setting the ControlSource of the TextBox to:

= DLookUp("SelectedFieldNameInQuery", "QueryName")

assuming that your Query returns a set of 1 single value.

Check Access VB Help on DLookUp which has usage examples.

--
HTH
Van T. Dinh
MVP (Access)


clickoo said:
Hi there,

Thank you very much for helping me out.

Can anyone please explain the DLOOKUP() function to me? I need to put my
query result (single number) in a textbox. Eventually, I intend to put that
result in a report. However I can't use Expression Builder to put the query
result in either my textbox or my report.
I shall be very grateful if somebody could explain in detail the DLOOKUP()
function to do all of the above things. People have asked me to use this
function to do the actions mentioned above, but I just can't seem to do it.
 

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