Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display query result within a Text Box

Status
Not open for further replies.

gibben

Technical User
Jun 2, 2003
18
NZ
Hi there I have a query that only returns one value, I am currently displaying it in a list box ......

The problem I have discovered is that until it is physically selected I can not use the value in there as a part of the data validation routine.

How would I go about using the query as the data source for a text box, I assume this way I will be able to access the value without the problems associated when using a list box.

Thanx
 
Hi there I have a query that only returns one value, I am currently displaying it in a list box ......


If the query only has one value for example INCOMPLETE, why not make it a text box with a default value of INCOMPLLETE. This way there will always be a value even if you change the value of the field.

I can't think of any reason to have a list box with only one value. But, there are many things I have never thought of!


An investment in knowledge always pays the best dividends.

by Benjamin Franklin
 
Thats what I am actually trying to do ... get a text box to display the value instead of using the list box.

The form has a Table as the datasource, the list box is driven by a query that takes a tally of a percentage value and displays that to the user. It is purely there as a reference for the user and for validating the form.

Eg: The user adds items

A @ 10%
B @ 20%
C @ 30%

everytime the user adds an item the list box updates and shows the total

Total 60%

Everytime the user adds another item it runs a check to see if the percentage of the new item + the total do not exceed 100% ......

Current situation is I can display the query value with a list box but for the VBA code to read the list box is needs to be selected .... however I am having no luck in trying to get a text box to display the value.

The user cant alter the data as it is a running total for their information ....

Hope this explains it a little clearer, the problem really is in me not being able to tie a text box to the query.
 
Don't have time right now to help. Just found out half hour ago that I was volunteered for something and will be out of town for several days.

Sorry, but I am annoyed (to put it mildly).

Hope someone else can help you!

Good Luck

An investment in knowledge always pays the best dividends.

by Benjamin Franklin
 
Thanks for your help so far anyway .....

No solution so far so if anyone can help me it would be much appreciated ...

Basically the short question is:

How do I display the result of a query in a text box on a form when the datasource for the form is not the query in question.
 
Try the following as your textbox source
=DLookUp("[name of query result box]","name of query")
Eddie
 
Thank You .... that worked brilliantly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top