Text Box In Form Displaying Value of Query?

CharlesWhiteman

Registered User.
Local time
Today, 00:23
Joined
Feb 26, 2007
Messages
421
I have an unbound Form.
I also have a query which just contains a total of a 'Count'
I want to display the value of the 'Count' in the text box of the unboundform. I will also be making other queries so do not want to bind the form to any one query.
I've tried some SQL and VB but as a novice am now out of ideas and reference. Any clues most grateful?
 
There may be other ways, and even more efficient ways, of doing this, but at the moment what comes to mind for me is, if the query returns just one row, you can use a DLookup in the Form's On Current event using that query as the "table" within it and just don't include criteria:

Me.YourTextBoxName = DLookup("[YourFieldNameInTheQuery]","YourQueryNameHere")
 
This is the code I used in the 'current' section of the events but when going from design mode to view mode the next box just says 'name?' in it. The Query is a field which is just a count of the query list.

me.CallsOutstanding = DLookup("[NextCallDue]","QryStartScreenTotalCalls"
 
There is no closing parenthesis ")" in your code. If it is a typo in code it's a critical issue.

I thought the dot and the bang are used for 2 specific purposes:

dot "." is used for objects/statements that come with Access

eg. Me!FieldName.SetFocus

bang "!" is used with objects you created

eg. Me!FieldName

so try:

Me!CallsOutstanding etc

Dave
 

Users who are viewing this thread

Back
Top Bottom