Assign Result of SQL Statement as a string to a Text Box or Label

Graham T

Registered User.
Local time
Today, 02:27
Joined
Mar 14, 2001
Messages
300
I have the following SQL statement that gives me a count of reviews:

Code:
SELECT Count(tblReviews.lngReviewID) AS CountOflngReviewID
FROM tblReviews
GROUP BY tblReviews.strISBN_Number
HAVING ((tblReviews.strISBN_Number)=[Forms]![frmLINK_Book_Author]![strISBN_Number]));

I would like to display something along the lines of "There are "X" amount of reviews for this title" - where "X" is equal to the result of the SQL Statement.

The text box/label will be present on the form and the count should return the result of the current book ISBN.

Would these need to be placed in the On_Current event of the form, if it is possible.

TIA

Graham
 
Set the controlsource of the textbox to:

="There are " & DCount("[lngReviewID]","[tblReviews]","[strISBN_Number]=" & "'" & [Forms]![frmLINK_Book_Author]![strISBN_Number] & "'") & " amount of reviews for this title"

You'll need it to requery on the oncurrent event.
 
Thanks Rob

Tested it and it does the trick....

I just wondered if there are any other approaches to this, other than DCount?

Graham
 
Probably is... I just prefer using D functions as lot.
 

Users who are viewing this thread

Back
Top Bottom