Query – Group By 2 Like Fields In A Table

Jun 6, 2006

My table looks like this:
Sales(a)||Date(a)||Sales(b)||Date(b)||Sales(c)||Da te(c)
1) 50 05/06 75 06/15 100 08/15
So I want to show all sales with the criteria - Date >05/01 <07/01.
The final query totals will be
Sales||Date
50 05/06
7506/15
So the issue is that there are 38 rows with similar data in each column
I have the table in this format because I also have a form that feeds off this table and it needs to be in this format-but I would also like to run a query/report from this table that summaries sales. I also know that since there is more than 1 date value in the row, this is going to make the query difficult to run (each date is linked to a certain sales total).
I guess what I want to do is transfer the horizontal data to vertical data (with certain criteria)
Please help!!!

View Replies


ADVERTISEMENT

General :: Group By Query And Adding Checkbox Fields To Update A Table

Oct 24, 2014

I have a invoice system I have created in Access and it did used to work perfectly and then maybe an update Who knows stopped the system working.

I have an customer order screen that has customer details and then a subform within the same form this takes a total of items & costs for this order and then it entered it into the customers table from the order_Details table using me.Order_total = Order_Total.

I know this is bad design but I store it because once the order is places I need the total to be static because the invoice has been sent and so if someone changes the order then the total owed doesn't change.

I then have a reconcile form which is on a datasheet form straight from the tab;e so it is editable which has a checkbox that then once ticked copies the total from the Order_Total in the table to the reconciled field in the same table and then I use a report to show who owes me still.

So I have made a Select query from the Orders table & Order_Details table and used a Group by Order number (Which is the link between the 2 tables) this shows correctly but now not editable because of the rules So I am trying to add an editable checkbox on the same form.

I tried to use a dlookup makes all of the boxes either ticked or not. I've been looking at Recordsets but I'm unsure if this is what I need or not really

So really I just need to see if I should be putting the Total from the Subform into the mainform and then entering it into the table (Like previously) using a calculated unbound field and then using the Afterupdate event to insert the data into the table. but for some reason it just wont work.

I can get the OnClick to work but then as soon as i go to the next record for some reason it then resorts to 0.00 but then the table shows correctly which ever record the form is working on.

Or should I be using the new query based idea to create the reconcile form and if this is the best way I just don't now where to start on how to get a multiple table query that I can then add a reconciled checkbox which then copies the Order_Total from the table to the Paymet_Recieved field.

View 13 Replies View Related

Queries :: Compare Data In 3 Fields In 1 Table / Group By Largest

Dec 4, 2013

I'm trying to create a query that will compare the data in 3 fields in a record, choose the largest (I also have a criteria to order by if more than 1 field has the same entry and it's the largest of the 3), and then group by that.The fields I will need are as follows:

PRODUCT table:
ProductName
Chemical
ChemicalAbstract
PhysicalState
NFPAHealth
NFPAFlammability
NFPAReactivity

qryQuantityOnHand query (which doesn't link directly to the PRODUCT table, it links through associations with other tables):QOH...I will eventually need information from another table for the final reports, but I don't think it has to be included in this query.

The fields NFPAHealth, NFPAFlammability, and NFPAReactivity each may be 0, 1, 2, 3, or 4...I need to ignore blanks; if 1 of the above fields is blank, they will all be blank.For any record, I need to compare the number in those 3 fields to each other, and choose the largest number and group by that rating.

In other words, if the largest of the 3 numbers is a 3 in the NFPAFlammability field, all those products need to be grouped together.If the same number appears in at least 2 of the fields, the order that determines the grouping is: Flammability, then Health, then Reactivity..Ultimately the report will be grouped as follows:

Flammability
Rating 4
Product 1
Product 2
Product 3

Rating 3
Product 1
Product 2
Product 3

Rating 2
Product 1
Product 2
Product 3

Health
Rating 4
Product 1
Product 2
Product 3

[code]....

and each of the groups will be sub-totalled.I'm stumped at trying to create the query in the first place.The added aggravation here is that we are dealing with 23 stores, each with their own mix of products. I have another table that contains the information about which products are in which store.

View 4 Replies View Related

Queries :: Sum Option Group Fields In Query

Mar 26, 2014

I had to modify how I was storing data on one of my tables. I changed checkboxes to an option group with the values ranging from 1 to 4.I need to count each of these entries for a report which will run them into another formula.I am trying to use the below - obv I'm doing something wrong.

Code:
Police: Sum(IIf([OType],1,0))

And this is the original SQL for my queries if needed:

qry_BLT_RCCounts1

Code:
SELECT Year([tblBlotter].[EntryDate]) AS [Year], Month([tblBlotter].[EntryDate]) AS [Month], Sum(IIf([OType],1,0)) AS Police, Sum(IIf([OType],3,0)) AS Ramp, Sum(IIf([OType],2,0)) AS Terminal, Sum(IIf([OType],4,0)) AS AOA, ([Terminal]+[Ramp]+[AOA]) AS TRATotal, ([Police]+[Terminal]+[Ramp]+[AOA]) AS TotalChecks, Year(DateAdd("m",-1,[tblBlotter].[EntryDate])) AS PrevYear, Month(DateAdd("m",-1,[tblBlotter].[EntryDate])) AS PrevMonth
FROM tblBlotter

[code]....

View 5 Replies View Related

Queries :: Cannot Edit Group By Query - Fields Reverting Back To Blank

Jun 8, 2013

I have a query where I group by EmpID, so duplicates do not show up. In this query I have two fields with no data. These fields are to be filled in after the query is run in a form. However, these fields are not editable due to the group by feature. I tried two unbound fields, which does allow me to type, but doesn't save the changes once I click out of the field. The field then reverts back to blank.

View 10 Replies View Related

How To Group Fields And Corresponding Fields, While Calculating Sums?

Aug 4, 2005

I have two tables - Hours and Employees. Employees table has these fields:
EmpID, and First, and Last name.
Hours table has these fields:
EmpID, Hours, Funding Source, Nature of Work, Pay Period

I need to produce a report or a query that will display these results:
A column with a list of all the employees and all the Nature of Work categories going across with the sum of hours for each Nature of Work. I'm attaching an Excel spreadsheet that shows kind of what I need. Also, these reports need to be produced for each Funding Source and
Pay Period, so something like [Enter Funding Source] and [Enter Pay Period]

My question is that I don't know how to make a report that will just list a column with all the names and count the sum of hours for each Nature of Work.

Hope this is not too confusing, and any help would be greatly appreciated. thank you!

View 8 Replies View Related

General :: String Manipulation On A Table - Text Is Gibberish In Group By Query

Jun 22, 2015

While processing string manipulation on a table (140K records, 200-250 MB) the file has corrupted, and I lost all vba Modules, but the data and other DB objects seemed to be in tact.

I now have a query with a text field, when I make a simple join SELECT, the text comes in fine (and, of course, seems fine when presented in table), but when Group by - I get Gibarish: "CARVEDILOL 6.25MG, TABLETS"

Is presented in Group by as: "ç …5"

I have recreated the file, importing queries, including this one, but then recreated it as a totally new query, but get that same results.

File Corruption? anything to do about it?

View 12 Replies View Related

Using Option Group For Yes/No Fields

Oct 13, 2005

Hi, all--
Perhaps a silly question:

I want to use an option group with a seperate check box for yes and no for a series of yes/no fields. I find that when I do this, once a record is started all have these items have "no" checked. I tried defaulting the value to null and other such things, but to no avail.

Any ideas (while retaining the concept)?

Thanks.

Paul

View 1 Replies View Related

Option Group ==&gt; Make Fields Disappear

Aug 28, 2005

hey, i hav seen a similar thread about this (i think bout a year ago or so) and i didnt no whether to continue it or start a new thread.Option boxes - Making items visible
that thread did not fully answer my question and after searchin around n finding nuthin i hav decided to ask

in my form i have the payment methods=> cash, cheque, credit. i did have these in a drop down menu, but i wasnt sure how to do what i wanted...which is based on the selection either make a couple of fields (credit card details etc) visible or invisible. so what i have done is changed the drop down list into an option group with radio buttons.
i currently have this coding

Code:Private Sub Frame_Click()If Me.Frame.Value = 3 ThenMe.CardHolder_Name.Visible = TrueMe.Credit_Card_Number.Visible = TrueMe.Expiry_Date.Visible = TrueMe.Type.Visible = TrueElseIf Me.Frame.Value = 2 ThenMe.CardHolder_Name.Visible = FalseMe.Credit_Card_Number.Visible = FalseMe.Expiry_Date.Visible = FalseMe.Type.Visible = FalseElseIf Me.Frame.Value = 1 ThenMe.CardHolder_Name.Visible = FalseMe.Credit_Card_Number.Visible = FalseMe.Expiry_Date.Visible = FalseMe.Type.Visible = FalseExit SubEnd IfEnd Sub

this seems to work although say if my first record has credit card selected, then all the fields are visible, but wen i move onto the next record which is cash or cheque...they are still visible until i reselect cash or credit again..(and vice versa)

i hope this makes sense :P
thanks

View 3 Replies View Related

Queries :: Join Multiple Fields From One Table To Same Table In A Query

Nov 21, 2014

I have a table that is basically a survey form. The same series of options was available for 35 questions, and the table used to have a text string written for each answer. Because of all the repetitive data, I created a second table that assigned a number value to each of the nine possible options in these 35 separate fields. What happened is that, instead of the same text strings repeated over and over (and taking up real estate), now each of the 35 columns had a single number in them.

Now comes the day of reckoning and TPTB want a query with the raw data and the original text strings back in instead of the numbers. I was thinking doing something along the lines of a DLookup, but I can't seem to make that work in a query correctly. Apart from calling the same table and linking it over and over to the different fields in the original data table (see photo for how insane that is).

View 2 Replies View Related

Queries :: Subtract Value From One Table From Each Item In A Group In Another Table

Apr 23, 2015

I have a database to keep track of time spent on development work. The database uses mainly two tables: Estimates and Status.

The Estimates table holds a static number for each item to be worked on. We generally subtract this number from the total number of hours in Status spent on each of the items. In queries, to calculate the overall delta, we subtract the Estimate from the overall Status for each item.

However, we would like to create a report that gives us a running total for each item. So, if we have 100 hrs in the Estimate table for Item A and 5 hrs for item B, then the report would ideally show something like this (delta between Status table and static value in Estimate table):

Code:

Item | Resource Name | Estimate | Actual | Delta
--------------------------------------------------------
A John Doe 100 10 -90
A Jane Doe 90 5 -85
A John Appleseed 85 5 -80
B John Doe 5 10 5
B Jane Doe -5 5 10

This is so that we can see how our actual hours spent working on a task line up to our estimates. So, if we are under estimating our work, we can easily see this.

In Excel, this is of course no issue, but it becomes an issue when trying to write a query in Access to report this information.

As I said, we can do the overall numbers, just not the line item numbers.

View 14 Replies View Related

Building A Query From Table Fields

Dec 2, 2006

Hi,
I am trying to make a query from fields out of 3 tables.
All tables must include following fields:

Table 1 fields:
WR04 (year 2004)
Date
Reporting Person

Table 2 fields:
WR05
Date
Reporting Person

Table 3 fields:
WR06
Date
Reporting Person

I am trying to pull together in the query any given individual (Reporting Person) who may be included in all above tables but believe I may have a relationship problem as I am only getting results that match all tables.
I hope this is clear.
Any suggestions please.

View 4 Replies View Related

Linking Fields Between A Query And Table?

Sep 12, 2014

In query design view, I have added a query with column (nameA) of names and a table with a column (nameB) of names. I am linking these two fields (nameA and nameB) which contain names. The names are spelled exactly the same so I should get results. Both fields are of the same data type.

But even when I add only the field with names from the query (the field called nameA), I don't get any results.

What is wrong here? Are there restrictions about linking a query to a table?

View 3 Replies View Related

Filtering Fields Of Table By Query

Sep 3, 2015

I am a student and I've just started to work with the MS Access and databases.

I am wondering if it is possible to filter the fields of table and display only specific information from that specific field. For example: The database (*.mdb file) is created automatically by the software (EPLAN Electric).

There are columns with fields like "de_DE@Verbindungsleitung;pl_PL@Kabel laczacy;en_EN@Connecting cable;en_US@Connecting cable;" But I would like to display in query/table filed only text starting from "en_EN@*" or "??_??@*" or display nothing...

I know that it is possible to display only rows which contain this text, but how can I get rid of fields from unwanted words...?

I cannot change original table of database because the parent-program (EPLAN Electric) will not recognize this database... And additionally data base is updated via EPLAN so every new field should be filtered in this way...

View 9 Replies View Related

Adding Fields In A Make Table Query

Oct 4, 2007

If I have a make table query where I want to add in some blank fields, say: Field1: “” , Field2: “”, etc…. is there a way I can make these fields a yes/no type instead of the default text?

I know I can manually go into the table in design view after I run the query, but I was hoping I could do it beforehand. :)

Thanks!

View 1 Replies View Related

Query 2 Tables, But Only Display Fields From One Table

Apr 3, 2005

I have two tables:

Employee
TokenID (PK)
name
location
post
..
..etc


Rating
TokenID (PFK)
FinalScore

I am trying to display all the fields from Employee table where Employee.TokenID= Rating.TokenID but I only want to display the fields from the Employee Table and not from the rating table. And each record displayed should be distinct by the TokenID....

View 5 Replies View Related

User Table That I Can't Normalize. Trying To Query 20 Fields!

Jun 15, 2006

I am using a table a user created which is like:
Member ID (key field)
Visit Date
Dept 1
Expense Code1 (combo box E through I)
Dept 2
Expense Code2
This goes on through Department 20.

Now they want to know how many E's for one month. I am stumped on how to normalize this or if it is even possible! I thought maybe there is a way to search the table as if it were a spreadsheet doing a "countif" function??

Any replies much appreciated!

View 1 Replies View Related

Queries :: Make Table Query On Like Fields

Sep 18, 2013

I am developing a Make Table Query from 2 tables, one of which has an "Employee Name" field (lastname,firstname) and the other table has separate fields for LastName and FirstName. I've been able to accomplish almost what I need by:

WHERE ((([Table 1].[EMPLOYEE NAME]) Like [Table 2].[LAST NAME] & "*"));

Which works fine except when there are 2 employees having the same last name, then it generates duplicates. I suspect there must be a way to do this by incorporating the first name field in the sql statement but that's beyond my ability. I realize that names are not good things to base a query on, but the 2 existing tables have been preset and populated by others and I don't really have the capability to change them.

View 3 Replies View Related

Reports :: Selecting Fields From Table For Query

Jan 13, 2014

I am looking for a way to generate a list of all fields within a table, have the end-user select which fields he/she wants to include, and then run the query. I am trying to create this within a form for a nice, easy to use GUI.

I am using Access 2010 on Windows. The fields I need them to select from are in one table, however there are many lookup (tblkp) tables related.

View 2 Replies View Related

How To Pass Table Fields Names From VBA To Query

Aug 15, 2014

I've been developing an Access database to keep track of my company's ongoing projects. There's also a form to browse the history of users actions within the program. It's based on table tbHistory that stores actions and parameters as numbers (for example eventId = 1 is "logged in" and eventId = 2 is "logged out"). I've been using a query to translate those numbers to text with a syntax like:

Code:
IIf([tbEvents].[EventId]=1 Or [tbEvents].[EventId]=2;[tbEvents].[EventDesc];IIf([tbEvents].[EventId]=5 Or [tbEvents].[EventId]=6;...

It worked fine but eventually the expression within expression builder has grown to the level that exceeded allowed limit and I couldn't develop my statement any more.. I decided to develop a vba function that would take eventId as a parameter and would retrieve a string, here it is:

Code:
Public Function translateHistory(eventId As Long) As String
Select Case eventId
Case 1 To 2
translateHistory = ""[tbEvents].[EventDesc]""
Case 6
translateHistory = "[tbEvents].[EventDesc] & "" <b>"" & [tbFormDesc].[FormName] & ""</b>"""

[Code] ....

And in my query I replaced that extremely long expression with just translateHistory([tbHistory].[eventId]). It seems to work, but the result it brings is a pure string with table names and fields - in other words, the query doesn't recognize it should be replaced with appropriate value. Here's the output I get:

Of course I'd like "[tbEvents].[EventDesc]" to be replaced with appropriate value of field "EventDesc" from table "tbEvents" as it used to be.

View 13 Replies View Related

How To Sum Fields In A Query With Different Date Criteria From Other Table

Aug 31, 2015

Table 1: contains sales summed by salesrep by week_date for 5 years + current
Table 2: contains sales rep, start_date and end_date

Query: Sum sales by rep where (start_date >= week_date and end_date <=week_date)

Each rep has different start and end dates.

View 7 Replies View Related

Automatically Add Rows To A Table Or Fields To A Query?

Mar 23, 2012

I am using Access 2007. I have an ODBC source feeding data into a table, to which I made a crosstab query that displays the useful data from that source. I need a way to add data(new field), using a form, that is a associated with the lines in the query. I've tried creating another table that uses the sample ID as the primary key, but I need it to automatically create a new row for each query line. Is there a way to do this, or better way to add data to a query. Examples are below.

The ODBC data looks something like this

SampleID PeakName Conc

sample1 THF 50
sample1 MEOH 10
sample1 propanol 25
sample1 butanol 15
sample2 THF 21
sample2 MEOH 15
sample2 propanol 17
sample2 butanol 23

I have the query look like:

SampleID THF MEOH propanol butanol (I need to be able to add a field here)
sample1 50 10 25 15
sample2 21 15 17 23

Linked table I created:

SampleID LIMS #
sample1 1234567
sample2 4567891

The problem is, for this table I have to manually select each sample ID. I want it to automatically add the sample IDs as new ones are querried.

View 3 Replies View Related

Reports :: Sum Group Items By Specific Item And Hide Details Of Group Summing

May 29, 2015

Despite Google I can't seem to figure this out.

I have some data in a format similar to:

Name / Style / description / speed / distance
john / driver / careful / 80 / 5500
mary / driver / careful / 70 / 7000
pat / racer / reckless / 100 / 6000
anne / driver / careful / 75 / 1000
peter / racer / reckless / 110 / 6500
don / snail / slow / 60 / 6000

I want my report to total by style, without details and to look like:

driver careful 13500
racer reckless 12500
snail slow 6000

How do you get a report to sum the group items by a specific item and to hide the details of that group summing?

View 2 Replies View Related

Designing Form But Table/query With Fields Not Enabled

Jun 29, 2005

im creating a form in design view but the icon to show the fields from the table that i want the fields to come from isnt being displayed; how do i get it to show?

View 2 Replies View Related

Can't Modify Fields In Form With Table INNER JOIN Query

Oct 5, 2004

Hello, exactly how Access 2002 and SQL operate is still a bit fuzzy to me.

In brief:
tableAccounts has fields for Signatory1ID and Signatory2ID, and other stuff
tableSignatories has ID for a primary key and has SignatoryTypeID as a field
tableSignatoryTypes has ID for a primary key and SignatoryType as a field

For each account, on a Form I want to show the Signatory and SignatoryType info for both signatory1 and signatory2. I have tried creating various queries and INNER JOINing the tables and/or queries together, but whenever I manage to get all the information displayed, none of it is editable. Access seems to lock the various text boxes and combo boxes.

Any thoughts?

View 2 Replies View Related

Adding Fields In A Table To Create New Field In A Query

Mar 14, 2008

I've got a fields called rev code that contain the following values:

field name: 110 131 250 255 258

field value: 7.49 6 11.25 12.11 78


I'm writing a query that pulls from the first two digits of the rev code and need to round off to the nearest dollar so in my query I'll have a column 11 with a value of 7, a column 13 with a value of 6, then I need to take columns 250 255 and 255 add the values together and round off so I get a column 25 with a value of 101.

How do I do that?

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved