only report grand totals from multiple queries - #Name? error Access 2013

RCBricker

Well-known Member
Joined
Feb 4, 2003
Messages
1,560
Hi all. I have a DB that I am creating for someone. I have all the tables set and all queries and reports are working great...except one.

They want a report that is basically a YTD of costs for medical expenses and prescriptions both by patient. I can do what they want in excel...I am having difficulties figuring out how to do it in access.

the report view would have

column A
patient name for meds category

column B would be the (grand total of all records) amount billed total
column C would be the (grand total of all records) amount approved by the insurance company
column D would be the (grand total of all records) amount of member co-pay

this format would repeat for each patient for the meds category

this format would then overall repeat for the Medical claims category.

there are queries for each of these categories that show all records for the YTD I intended to create the report and then point to various queries and use an expression within the control source of the text box to present the data. However, I am getting a #name? error.

Any ideas how I can create this report?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If you're going to use multiple queries, then a report/sub report design will be required. This may introduce problems if you need overall totals including values from the subs. an
...expression within the control source of the text box to present the data
Calculated controls can only go in report footers (group/page etc.) so that may be the issue for the Name error (guessing since I can't see where you put them).

Sounds to me that an overall query that gets all the data should work if you group by type then patient id (in report design). The records would probably look like this (second set of numbers omitted - too lazy)

MedsBilledApprovedCo Pay
patient 110525
patient 2201030
patient 3301535
Claims
patient 1
patient 2
patient 3

<tbody>
</tbody>

However, you don't say if you want individual records or just grand totals, so is it a totals query or select query that is the report data source? If the former, your calculated controls would go in the patient group to total by patient, and/or the type group to total by Meds or whatever. If the latter, calculated controls won't be required if the query supplies the data. Having only calculations doesn't really help when you start seeing wonky numbers and you have no clue in the report whether or not they're reasonable.
 
Upvote 0
Thanks as always Micron.

I will apply your advice to my project and come back if I screw your solution up.

the example of how the data will look is spot on.

I pretty well suck at Access as my experience lies in excel. But this is a favor for a friend so I am trying to work all this out. I tried an overall query, but maybe I need to look at queries involving multiple tables more. When I tried to gather the meds and claims together it created a query of records for each of the claims (first table used in query) and then created multiple lines of each of the meds (by far more claims than meds so it just filled in the records with copies of the meds). I will go back and see if I can get it figured out. So much easier to do this kinda crap in excel.

As for the wonky numbers, The data for claims and medications is provided in a different report. This is a tracker for YTD costs at a glance. It will only really be used per quarter or end of year for reporting costs purposes. The other detailed reports will be used for normal monthly reporting.
 
Upvote 0
Too many records? Try DISTINCT and DISTINCT ROW predicates.
 
Upvote 0
Too many records? Try DISTINCT and DISTINCT ROW predicates.

ok I will look that up see how that works.

BTW any idea why after running my database that it needs to be re-set before it will allow me to run it with out bugging out?

Different database that uses excel it bugs when creating the first sheet on the re-run.

I close the first run by clearing excel with the following:

Code:
    With appEXCEL
        .ScreenUpdating = True
        .DisplayAlerts = True
        .Calculation = xlCalculationAutomatic
    End With
    
On Error Resume Next
    Set dbF = Nothing 'my database variable
    wbRECON.Close False 'my excel workbook variable
    Set wbRECON = Nothing
    appEXCEL.Quit  'my excel application variable
    Set appEXCEL = Nothing
On Error GoTo 0

the error I get is Run-time error 91. Object variable or with block variable not set.

However, once I hit the reset button in the VBE the code runs fine.
as always I appreciate your advice
 
Last edited:
Upvote 0
I can't recall ever getting this error by not correctly creating a With block. It has always resulted from not declaring an object variable. Based on your reset comment, I'd suspect you have a global or module level variable that you think is still instantiated but is not, and resetting causes everything to start from scratch. Based on your limited code sample, I'd guess that dbF, wbRECON or appEXCEL does not exist on the second attempt after you've set them to Nothing. You'd have to post the code for the routine for me to even have a chance to pinpoint it. However, this sounds like it should be a different thread.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top