Solved

ACCESS DATA SHEET DISPLAY

Posted on 2013-11-13
3
322 Views
Last Modified: 2013-11-13
Hello,
I have an Access 2007 database in which I allow the user to custom build a query. This is done via a series of check boxes. For example: 1) Show all members who are paying by credit card AND the member has not chosen to skip AND the member has not cancelled, etc.

From the information provided by the user in the check box group, I am building a SQL string. The string becomes a query definition and the query is executed. Currently, the user is shown the custom filtered information in a datasheet format.

Here's my question: The user doesn't care about the filtered data (datasheet view). All the user wants/needs to see is the number of members who fit the criteria selected. How is this done?
0
Comment
Question by:waverobber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39646626
He's one way:
DIM rs As Recordset

SET rs = currentDB.OpenRecordset(strSQL)
If rs.EOF Then 
    Me.txtResult = 0
Else
    rs.MoveLast
    Me.txtResult = rs.RecordCount
End If

Open in new window

Ron
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39646631
You can use a Count query, or use DCount.

The Count query would be something like:

Dim s As String
s = "SELECT COUNT(*) AS RecCount FROM YourTable WHERE <Your criteria here>"

Dim dbs As DAO.Recordset
Set rst = Currentdb.Openrecordset(s)

Msgbox "The number of customers is " & rst("RecCount")

DCount would be similar:

Dim i As Integer
i = DCount("IDField", "YourTable", "Your Criteria Here")

Msgbox "The number of customers is " & i

Obviously you'd have to change table and column names to match your own. Also, "Your Criteria Here" would be the same WHERE values you're already using to create your query definition.

Here's more info on DCount:

http://office.microsoft.com/en-us/access-help/dcount-function-HA001228817.aspx
0
 

Author Closing Comment

by:waverobber
ID: 39646689
Works perfect. Thanks...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question