I am currently working with different tables and queries in Access and I can't find a way to do something very simple. I have the following :
Two queries, qry1 and qry2
One table, tbl1
Both queries and the table have a "NET" field of type float (or double)
What I'd like to do is create a very simple report which would give me the total of the NET column for each of those three objects. I have tried to insert a text box in a blank report and selecting sum(NET) on qry1 in Control Source but it doesn't work, it simply prints '#Error' with no more information.
If I use 'Add Existing field' and drag&drop 'NET' from tbl1 and then edit it to add sum it works but it is repeated for each row which is obviously not what I want. It feels like I'm missing something here or that I might not be using the right tool.
Thanks in advance for your help!
Have you considered the DSum() function? Create three text boxes and set the control source for each text box as follows:
=DSum("NET", "qry1")
=DSum("NET", "qry2")
=DSum("NET", "tbl1")
Note: Aggregate functions (e.g., DSum, DLookup, etc.) have poor performance compared to performing the calculations within a query. It's not clear from your question whether that's an option for you or not.
Related
When writing expressions for a row in Power BI Report Builder, things line up just fine until you get data that is a lot of text.
This is a prime example
I have 'cangrow' to true on all of my individual cells as well as the row group / row itself. Nothing seems to fix this. Is there any way to do this so the rows expand accordingly?
Ideally, I'd something like this.
EDIT:
I believe the real problem is that I wasn't using a subtables because subtables look really bad when there are column groupings that block the merging of cells.
I'm now trying to find a way to basically add a completely separate table beneath the top table but still connected to be reported each match. First step would be find a way to have a separate data source in the subtable. Step two would be to allow the formatting of the subtable without the structure of the first.
I can't extend the subtable to the final column because of a required column group. And my expressions can't really do what I need them to without changing the dataset to something other than the main table.
Thanks for the help!
FINAL EDIT 2:
1) To resolve the separate dataset problem, I had to write a disgusting query to join the two sets I was using into one. I'm not sure there is a way to do that with Power BI Report Builder, although there should be.
2) I had to put the two separate tables into a list so they would be okay with formatting.
Got my problem solved, but in a round about way.
1) To resolve the separate dataset problem, I had to write a disgusting query to join the two sets I was using into one. I'm not sure there is a way to do that with Power BI Report Builder, although there should be.
2) I had to put the two separate tables into a list so they would be okay with formatting.
Got my problem solved, but in a round about way.
SSRS matrix table is a great way to generate dynamic fields as long as values exist.
However, is there a way to "always" show these dynamic fields even if a value doesn't exist for them? The report field locations varies based on data availability and users have to add missing columns in Excel manually.
Dynamic fields go from 3 to up to 30 (at least for now based on run by values). Adding these values manually would make the report hard to maintain.
The way I have handled for this is in the SQL. I build a table of all the values I will always want, I cross join that table to my final output table and update/insert values where they need to exist. That way I guarantee the rows, and eventually columns in the matrix, exists even if they end up being null.
Does that make sense?
Jesse's solution is a good one, but if for whatever reason you can't or prefer not to change the SQL you can do it in SSRS by forcing a blank value in the cell with a expression like this:
=iif(IsNothing(Fields!.xxx.Value)," ",Fields!.xxx.Value)
I have two tables and from that I am generating a query. I have columns in my query with field type yes/no. These are basically columns to determine the race of a person. The user enters information in yes/no for various races. I want another calculated column in the query which checks for all other race columns and calculates values in it.
I have to check for a few conditions in for the values in columns
For example:
1) If Hispanic is chosen, the new column should say hispanic(no matter what other options are selected. This is like a trump card)
2) If more than one is selected, then new column entry should say "multi"
3) If none of the options are selected, it should say "unknown"
4) If exactly one of them is selected, then that race should be displayed
Can anyone help me with this? I am new to Access
I can't code it for you but I can point you in the right direction. What you want to do is take all the tests you explained above and put them in a coded format :
iif ( condition, value_if_true, value_if_false )
Since you have a lot of possible outputs i'd use something like a Case Statement where you can test for all the possibilities.
Follow this link if you need any info on how to code both type of statements (iif and case).
Once you have tried something like this, you can comeback with a specific question if you encountered a problem in the process.
Good luck with your database.
I'm having a little trouble with the form filter in Access 2007. I'm using the listview in a few forms and the user needs to be able to filter there.
For testing purposes I made a query, which is just based on one table. If I want to set the first filter, it looks like that:
I choose a value and if I want to set another filter (on a different field obviously), there aren't values available to choose from.
This seems to happen only if I use a query (doesn't matter if I use every field, or just a few, based on one table or multiple linked tables). I can of course use the number filter and enter a value manually.
I have another database, where I can use filters when and wherever I want, regardless whether it is a query or a table - I have a list with values to choose from everytime. This means I messed something somewhere up but I have absolutely no clue where.
I'm using Access 2007 (FE/BE), if you need any further details, just ask. Any advice where to start looking is very appreciated!
Well, after playing around for a long while, I figured out what the problem is.
The form recordsource needs to be a query - no sql code, no "select * from query", just the name of a query. Anything else leads to the fact that you are limited in using the filters. I'm not sure if this is a bug or if there is a reason behind this, but that's the way it works in access 2007 - at least for me.
Before I was dynamically adding conditions to my queries which led to a recordsource like "select * from qDeliveries where location = 1". To accomplish this I now just create a temporary query which is the form recordsource instead of just using the sql code.
Hope this helps anyone... :)
Instead of using a query, try this:
File >> Options
Current Database
Scroll down to Filter lookup options
Check ODBC Fields
Close and re-open the file. That should solve the issue.
Create a Separate query and assign to that form. instead of create query within the form. Your problem might get resolved. I did the same way it's working fine for me.
I have about 35 queries in a large MS Access (2007) database that I would like to use in a report. However, I don't want to create reports for each query, but would rather include multiple queries in one report. The other questions relating to this on SO seem to be related to tables, but I am mainly concerned with just queries.
I have looked at several solutions so far, none of which seem to help:
1) DLookup - returns one value. I need to populate a report with many values from each query.
2) Subreports - I have tried to create text boxes to link my query data, but since they are unbound, it won't let me.
3) Yelling at it. I keep yelling at Access and it doesn't seem to help.
4) One giant query to get the values from all the smaller queries - it doesn't recognize the expressions I built in the smaller queries. Example: CustomerCount = DCount("[Customer_ID]","[Customers]"). Error: 'CustomerCount' is unrecognized.
Any ideas would be greatly appreciated.
Thanks,
If you are creating a report from one query that is made up of multiple subqueries, you can do this by populating textboxes. If looking at the properties on the report > Data tab > Control Source, you would place the name of the your subquery from your giant query and then the value you that you want.
For example:
Master query
SELECT
[Deb<30].CountOfACCT_ID, [Deb<30].SumOfB001,
[Deb<60].CountOfACCT_ID, [Deb<60].SumOfB001,
[Deb<90].CountOfACCT_ID, [Deb<90].SumOfB001,
[Deb>90].CountOfACCT_ID, [Deb>90].SumOfB001,
TodaysHD.CountOfACCT_ID, TodaysHD.SumOfB001,
TodaysLD.CountOfACCT_ID, TodaysLD.SumOfB001,
Part.CountOfACCT_ID, Part.SumOfB001,
FROM [Deb<30], [Deb<60], [Deb<90], [Deb>90], TodaysHD, TodaysLD, Part;
Each of the items in the FROM portion are subqueries being pulled into the master query. Then in your report you would populate the Control Source with [Deb<30].CountOfACCT_ID or whatever value you need from the master query. I have this setup in multiple reports in my application so it should work.
as for 2) you should be able to bind your controls, your subreport should have a record-source.
Else, try listboxes, their graphical apperance isn't exactly flexible, but they might get the job done.
regards,
//t