Queries :: CountIF - How Many Plans A Retail Chain Has Over Its Stores
Dec 2, 2013
I am trying to count how many plans a retail chain has over its stores.
So
WeekNo | StoreNo | Product |PlanNo
1 | 10001 | Dog | A
1 | 10001 | Cat | B
1 | 20008 | Dog | B
1 | 30005 | Dog | B
Query/report to show
Product | PlanNo A | PlanNo B
Dog | 1 | 2
Cat | 0 | 1
Numbers in Query/report are a count of Stores selling the product
One of the issues is that the data is duplicated over the weeks, I'm thinking to use max on week number so It only looks at the last available data. And how to write the query.
Currently I'm doing this
PlanA: Sum(IIf([PlanNo]="A",1,0)
PlanB: Sum(IIf([PlanNo]="B",1,0)
.
.
.
But it looks at the whole of the table for all the weeks...
View Replies
ADVERTISEMENT
Nov 4, 2013
I have generated a table using a crosstab query and it gives the information as below
12/10 12/11 12/12 13/01
Part 1 1 2
Part 2 4 4 4
Part 3 5
So basically part, qty used, year/month used - it works fine up to this point.
Now I want to either add more columns to the crosstab query to count number of times Part 1 was used in last 12 months & 24-13 months
Or
Create another query to do this.
But I want the count function to start counting from current month to last 12 months and from month 13 to month 24 (in another column).
The problem I am having is that this query will run every month and I don't want to update the column headers (in query property sheet) instead I want query to pick this up automatically.
I use the design view to generate queries.
View 1 Replies
View Related
May 5, 2007
Access Guru's:
I am a beginner at best with Access. (I'm using Access 2003) I have a small in home business as a second job making silk flower arrangements. I am now to the point that I need to track my inventory, quantity used, COGS, etc. Most of my arrangements are in gift shops on consignment.
In lieu of buying Quickbooks Manufacturing ($$$), I want to start tracking everything with Access so I can at least get some nice reports at tax time.
The problem I am having is I cannot translate the tutorials that Microsoft supplies to this application, they only cover setting up basic tables. (ie: in a retail/inventory application - do I set up 1 table, 1 table & subtable, 2 tables????)
I set up a table so far with 4 basic inventory fields:
Item description (record includes: flower, vase, foam, etc) / Color / Qty on Hand / Cost. Then (on the same table) finished goods fields of: Qty Used / Arrangement # / Qty Left / Sold for. While trying to figure out how I am going to track how much each arrangement cost, I'm not sure this set up will work.
I probably went into too much detail for my question, but I wanted to give some kind of background. Is there a CD/Book/Tutorial that specifically guides one through setting up a retail/inventory table?
Sorry so wordy.
Catherine
View 1 Replies
View Related
Dec 14, 2013
I need to create a SIMPLE solution for Retail rounding. Below are is an Example of Detail lines in a DataSheet Form that represents the price for an Item.
QuantityXUnitRate = Quantity * (UnitRate*Pct)
$14.0049 = 1 * $10.53 * 1.33
$14.0049 = 1 * $10.53 * 1.33
I need the price to end with a Currency Decimal of $$$$$.x9 for all prices. The example above rounds to $14.00 for with 2 digit rounding or if I use 3 digit rounding $14.01.
I need it to be rounded with a .x9 either $13.99 or $14.09 or to the nearest .x9.
Subsequently, every Detail line we calculate in the Datasheet needs to end with an .x9 for Retail Pricing.
There are thousands of different UnitRates (costs), and the Pct (Percent of Markup) can also change.
Additionally, I sum the Detail Lines and the Totals need to match. One of the Sum Fields is Calculated as
=Sum(IIf([taxable]=True,Nz([QuantityXUnitRate]),0))
This ends up Totaling to $28.01 which is wrong for 3 Digit rounding of the Detail Line, because $14.01+ $14.01 = $28.02.
I also tried Rounding
=Sum(IIf([Taxable]=False,Nz(Round([QuantityXUnitRate]),0),0))
And after that I still got the wrong amount $28.00.
I tried this with 2 instead of 0 with no difference
=Sum(IIf([Taxable]=False,Nz(Round([QuantityXUnitRate]),2),2)),
I know one of 2 refers to the Nz and the other to Rounding, but I not sure which is which at this point.
If the last significant digit need to be .09 or .19 or .29 or .39 or .49 or.59 or.69 or.79 or.89 or.99 then everything should Sum up correctly or I hope.
Here is another Example
QuantityXUnitRate = Quantity * (UnitRate*Pct)
$14.0049 = 1 * $10.53 * 1.33
$22.2642 = 1 * $16.74 * 1.33
However, I get the correct Detail Line of $14.01 and $22.26
and using =Sum(IIf([taxable]=False,Nz([QuantityXUnitRate]),0)) same as above, I get the correct amount $36.27.
How to make a with a SIMPLE solution where all Decimals end up with a .x9 and then I'll tackle the Sum if necessary.
View 14 Replies
View Related
Feb 3, 2015
Basically I have this formula in excel and i'm trying to recreate it in access but i can't quite figure it out.
****a***********b**********c*********d*********e** ******f
3**Car***Cost Center****start****combining*****end*****miles
4**001*****aaa********021****=(A4&" "&C4)***030
5**002*****bbb********030****=(A5&" "&C5)***035
6**002*****aaa********035****=(A6&" "&C6)***040
f4: =IF(COUNTIF($D4:$D600,D4)=0,(E4-C4),(E4-C4)/COUNTIF($D4:$D600,D4))
f5: =IF(COUNTIF($D5:$D601,D5)=0,(E5-C5),(E5-C5)/COUNTIF($D5:$D601,D5))
f6: =IF(COUNTIF($D5:$D601,D5)=0,(E5-C5),(E5-C5)/COUNTIF($D5:$D601,D5))
So basically: If a car is using multiple cost centers for a trip it divides the total mileage among the cost center for said trip provided that the user enters the same start and end mileage on all the cost centers used. And if it doesn't have multiple cost centers it provides the appropriate amount.
=IF(COUNTIF($D4:$D600,D4)
=IF(COUNTIF($D4:$D600,D5)
=IF(COUNTIF($D4:$D600,D6)
and so on
Any way to reference a column in access while referencing a specific point within that column.
View 2 Replies
View Related
May 28, 2015
Using Access 2010
I'm an expert user in Excel and am trying to learn more about Access, so I relate many of the functions to what they are called in Excel. And what I'm trying to do right now is count the number of fields in a specific record where the value is a specific result (CountIf).
For example, I need to return the number of fields in a specific record where the value is "Meets Requirements". The specific record will be determined by the Name, Contact, and Email fields (which together comprise the Primary Key).
Is there a way to count the values in multiple fields that equal "Meets Requirements"?
View 7 Replies
View Related
Oct 9, 2006
first time poster, please be kind.
I am currently updating our supply stores database in work. When an item becomes unserviceable we need to attach a form to the item before sending it away. i would like the data entered into the 'unserviceable' table within my database to be transposed onto an excel spreadsheet (see attachment) and then automatically printed out with the data in the relevant boxes. Can anyone tell me how this is done please? My knowledge of access is rather limited and I am teaching myself as I go along.
View 1 Replies
View Related
Sep 18, 2005
Hella all,
I'm new to this forum :) so I say hello to all of you :)
I have a little problem..
I have a table wich stores information wich comes from a combobox.
The problem is that it saves the combobox ID instead of the text.
This is the row source of the combobox
SELECT rapporteur.ID, rapporteur.rapporteur FROM rapporteur;
Could somebody tell me how I can store the rapporteur.rapporteur in a other table instead of the rapporteur.ID?
thx a ton in advance
View 7 Replies
View Related
Sep 18, 2005
Hi, I'm new here also. I'm afraid I can't help with your question, but I have 2 questions of my own.
1) how do you start a new thread (as you have done?)
2) in my database I have thousands of contacts. How can I add an alphabetical index tab along the right edge such as in Outlook for one-click access to different parts of the database?
Thanks and I hope you can help!
Gary
View 2 Replies
View Related
May 23, 2006
Hi,
I am using group options and they store a number instead of the vaules you typed in, is there anyway of making a group option that will store values and not numbers?
View 9 Replies
View Related
Oct 6, 2006
I have a form which is associated with a table. When I put some values in the fields which are connected to the database and try to close the form, it gives me an error that "Can't insert record the primary key might be duplicated"...! and then it closes.
Does the form store a record in the table while closing??
If so is there a way to prevent it??
Please reply..
View 3 Replies
View Related
Oct 7, 2013
Does access have WITH subquery, For example creating a variable that stores a whole subquery such as:
Code:
WITH variableTEST (a, b, c, d, e) as
(SELECT a1, a2, a3, max(ab), count(*) as nbids
FROM A x natural join B y
WHERE x.something > y.something
GROUP by a1, a2, a3)
WITH variableTWO (f, g, h, i, j, k, j) as
(SELECT A.bidder, W.a, W.b, W.c, W.d, W.e, A.something
FROM variableTEST W natural join B A
WHERE W.sprice = B.bidprice)
SELECT h FROM variableTWO WHERE now - j <7
Can it do something like this, if not what alternative do they have to do something similar? Using WITH and subquery and variable, and storing variables and then later use it again in another subquery, can it do something like this in access SQL?
View 5 Replies
View Related
May 24, 2006
Hi,
im after a option group that stores multiple values, the only way, long winded as it will be is to create a table with all the values then have tickboxes for all of them.
Is there a simpler cleaner way?
View 1 Replies
View Related
Jan 1, 2014
Im trying to work on an db in Access 2007 that was migrated from Access 2003 (in fact its been migrated several times starting from Access 97). It executes and runs with no problems in both versions.
The problem is when trying to open some queries (not all) - Access is unable to open the query in design mode and gives me this error :
" is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
However, as I cant open it - I cant check it. Im pretty sure none of the fields have invalid characters (they do have spaces) and Im not sure how long is too long....
View 6 Replies
View Related
Jul 18, 2013
I'm using Access 2003 and excel 2003.
We currently manually run 5 different queries then copy and paste this data into 5 separate tabs on 1 workbook, I'm trying to automate some of this process if possible.
I am trying to use the 'transferspreadsheet' action within a macro to run a query and post it into a template excel file, using this code:
Trasfer Type Export
Spreadsheet Type Excel 8-10
Table Name (query Name)
FIle Name (FIle location)
Has field names No
Range Blank
----
This does seem to work and puts the data on a new tab on the specified workbook.
However I have a few questions:
1. Can you specify which query gets put onto which tab in excel? The tabs have different fixed names.
2. Can you specify which Cell the data gets pasted into to? As each tab has a set of headers and titles which need to remain.i.e would need to get query 1 to start in cell A4.
3. How would you expand the above out so that it runs all 5 queries, would you just add in multiple transfer spreadsheet actions in the same macro?
View 1 Replies
View Related
Dec 2, 2014
I have 3 cross tab queries that are completely identical with the exception of the field that they pivot. Each field is searching for the same values just in different columns, with the end goal being to get the sum of the values for each pivoted column. I'm wondering rather than having 3 almost identical queries is there a way to use a crosstab to sum the values from each of the three fields rather that having 3 queries which then have to be aggregated in a fourth?
QUERY1
Code:
TRANSFORM
IIf(Count(PT_LEVEL.UNIT) Is Null,0,Count(PT_LEVEL.UNIT)) AS CountOfUNIT
SELECT
PT_LEVEL.INF_YEAR,
PT_LEVEL.INF_MONTH,
PT_LEVEL.UNIT
[code]...
View 2 Replies
View Related
Feb 24, 2015
I have a crosstab queries which uses the date query parameters. However, when I go to my Export command (code is below), it ask me to enter the date parameters (start date and end date) twice. What do I have to do so that the system will ask me to enter once only?
Code:
On Error GoTo Err_cmdTest_Click
'Must 1st set a Reference to the Microsoft Office XX.X Object Library
Dim dlgOpen As FileDialog
Dim strExportPath As String
Const conOBJECT_TO_EXPORT As String = "qryEXPORT"
[Code] .....
View 9 Replies
View Related
Jul 31, 2013
I have 3 queries named Mech Final Equipment 3 Mth, Mech Final Equipment 6 Mth, and Mech Historical Final Equipment.They all have two fields-Final equipment and Sum of Sum of Down (calculating the number of minutes each piece of equipment was down in the time period selected).
My ultimate goal is to join the three queries to display a pivot chart that uses the Final Equipment as the category field and 3 Mth, 6Mth, and Historical as seperate data fields.What I have is a join query (Which I have named Mech Final Equipment H63 Joined)
Using this SQL:
Code:
SELECT DISTINCTROW [Mech Final Equipment 3 Mth].[Final Equipment], Sum([Mech Final Equipment 3 Mth].[Sum Of Down]) AS Duration
FROM [Mech Final Equipment 3 Mth]
GROUP BY [Mech Final Equipment 3 Mth].[Final Equipment]
UNION
[code]...
Which returns a table that looks like this:
Final Equipment, Duration
Ancillary Equipment, 225
Ancillary Equipment, 401
Ancillary Equipment, 1787
Brush Unit , 1252
Brush Unit , 2519
Brush Unit , 8004
And so on.What I need the table to look like is this
Final Equipment, 3 Mth, 6 Mth, Historical
Ancillary Equipment, 225, 401, 1787
Brush Unit, 1252, 2519, 8004
And so on, like a cross tab.I tried to do a crosstab query but I don't have enough fields.
View 6 Replies
View Related
Jul 16, 2013
I have three Queries and I need to export three queries into one workbook but different worksheet,
Currently I am using ExportWithFormatting , but the result came out is three different workbook .
Is there any way I can export to one workbook ?
View 3 Replies
View Related
Feb 18, 2014
I am trying to add calculations to queries based on columns in the query... it seems to randomly expect 'Expression' or 'Group by' as column types, and Im having to create 3 sets of queries following on from each other to de-dupe data and allow filters on calculated values.
Also I've got a function which turns a date into a quarterly cohort, e.g. Oct 2013 -> 20134. I use ot on a lot of dates. I created a VBA function, CohortQ used as follows in queries:
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 CohortQ([InputDate]))
In the VBA, InputDate is defined as a date
Code:
Function CohortQ(InputDate As Date) As Integer
If InputDate = 0 Then
CohortQ = 0
Exit Function
End If
[Code] .....
But when I run it on a date field, it gives me a data mismatch error. I can't step through as it's working on 600K rows.
If I put the function into the query,
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 Year([InputDate])*10+DatePart("q",[InputDate]))
it works.
View 3 Replies
View Related
Jan 24, 2014
I have two queries, one base upon the other. I would like to combine them (If Possible) into one query so I can embed them into a form or report. I have tried without success at finding the answer on the forum as well as searching the web.
The table lists employee numbers and dates they worked. I need a count of how many employees worked each year, based upon the paycheck date, not the actual date worked. Pay check dates are two weeks apart. An extreme example, is the first pay check date of 2010 was on 1/1/2010, but all the days worked were in 2009, this would have to be included in 2010 not 2009(See the query for further date calculation understanding). Anyway, the date calculations are not the issue here.
I only have one table, so if I am not mistaken, I can't use the WHERE (SELECT... JOIN) feature. I also was unsuccessful at using SQL DISTINCT.
I am running ACCESS 2010 Tables are ACCESS 2007.
OS is Windows 7 Ultimate.
I have included a same database with the queries. qryEmployeesAnually2 is the results I am trying to achieve.
View 7 Replies
View Related
Sep 24, 2013
I have a query which returns a calculated percent. I have ordered that in descending order, and now want to see the top 50. So (In Access 2010) I entered 50 into 'Return'. But it returns all of the records!
Is this because pct is a calculated field? How can I correct this? The SQL seems to be correct.
Code:
SELECT TOP 50 HeciFail1.POHECI, HeciFail1.POQTY, HeciFail1.FAILQTY, IIf(Nz([FAILQTY])>0,Round(100/([POQTY]/[FAILQTY]),0),0) AS PCT
FROM HeciFail1
ORDER BY IIf(Nz([FAILQTY])>0,Round(100/([POQTY]/[FAILQTY]),0),0) DESC;
View 1 Replies
View Related
Feb 23, 2015
How can you export cross tab queries by using date parameters (for example: Jan 1, 2014 to December 31, 2014)...
View 3 Replies
View Related
Apr 30, 2015
I was wondering how to do a crosstab query and have to column headings
I need the Organization Number and the Org name..so something like this
4005 4010
Office of HQ Office of Accounting
Is this possible?
View 2 Replies
View Related
Sep 30, 2014
I am working on a report that has some special characteristics.
Let's say I have a list of groups of Vendors in a table, complete with VendorID. I have 3 other tables that use the VendorID: Complaints, Complements, and Terminations.
Each of these tables has a date that the Complaint, Complement, and Termination notice was received.
Every Fiscal Quarter, a report is pulled that looks back over the 4 preceding quarters to determine if a 5% threshold has been crossed by any of the vendor-groups in regards to the amount of Complaints they received.
The equation used for that is : (complaints/vendors_in_group)*100
It is imperative that the information has the current fiscal year and fiscal month (which I am tracking with functions from MS website), and I need to be able to store the information attached to the fiscal year and month.So when a user goes to the form and inputs the desired Fiscal Year and Fiscal Month, the database can display the 4 previous quarters of information...split into Q1, Q2, Q3, and Q4.
What I would like to have happen is to be able to have one table where the information is stored, quarterly, so that it can be retrieved for the report.
Questions:
1. Is it possible to have one line, per VendorID, that has the total number of Complements, Complaints, and Terminations, as well as the threshold percent stored in a table? Right now, I am getting LOTS of duplicates and blank lines when I try to put them all together. It has the right data, but takes about 10 rows per VendorID.
2. It is very important that the total number of Vendors in a group be captured on that quarterly report, so maintaining that number, in the same table, is essential and must be tied to the VendorID.
3. I have looked at Union Queries and Crosstabs, but I just dont know enough about them to make it work.
View 4 Replies
View Related
Jan 14, 2014
Using Access 2010. Have been using a simple query to count similar items. All of a sudden I cannot get the sum of the count. I don't know if I have done something wrong or my program won't work correctly.
The DB is attached. The only query shown is an example of what I want to total, but I cannot get any total.
View 7 Replies
View Related