I want to use to Group by clauses or a Group by and Order By cloause together. Below is what I am striving for. I am using a Union query with a date parameter. When I try to add the Order By Clause I get the error "You tried to execute a query that doe snot include the specified expression 'rate_type' as part of an aggregate function.
System Rate Type ....
Name 1 Fixed ....
Name 1 Variable ....
Name 2 Fixed ....
Name 2 Variable ....
I have 3 fields in my db, themeID, occasionID, and recipientID. Each field has its set of numbers. What I want is to get certain products say for recipient 3 but not occasion 3 only if theme is all but 5. How can i do that?
SELECT* FROM tblProduct WHERE RecipientID='3' AND (OccasionID <>'4' AND ThemeID <> '5') order by ItemNumber Asc
i know the code i have written above is incorrect.. i wish i know how to write if is even possible and if statement. Please help. THanks in advance
I am having trouble opening a datasheet form with mulitple where clauses here the VB that I have so far
Private Sub Command192_Click() If IsNull(Me.Startdate) = True Or IsNull(Me.Enddate) = True Or Startdate = "" Or Enddate = "" Then MsgBox "Start AND End dates are required" ' Exit Sub '
This is a database that uses user-level security setup in Access 2003 but it is being run on 2010. An update to the security system is in the cards in the near months, but right now I need to add one more user and I am having an issue with that.
I can add the new user in the user and group accounts form and I can add him to any group except for one. Unfortunately that is the group that he needs to belong to. You can see in the attached image the new user (jschiff) and the group I want to add him to. There already are some other users in that group. What could prevent me from adding this new user to that group?
I'm having a problem trying to have my query place the group record count on my form. The scenario is this: I have the query name (SPED Main Query Count) group the School Name field and then count the school name which in turn gives me a count of each school. but for some reason the field in the table name School Cnt will not build a relationship with the Countofschool Name in the query in my relationship.
I have an simple option group (3 options 1,2 and3!!)I am building a query where I need to display records whose option group field in the table is empty. I have tried:
field = Int(0) field = "" field = null isempty(field)
I need some help with a Where clause in a SQL statement.
What I am trying to do is use a value that is displayed in a text box on my form as the filter criteria in a list box.
On my first form I have the user select his username from a combo box. He is then prompted for a password. Once he gets past the password form, it allows him access into the main data entry form. Once he's in, the UserID he selected from the first form is automatically displayed in a textbox known as [Text689]. This text box is set to Enabled.False so it can't be changed and it's control source is set to the table as UserID.
I have another listbox setup on the main form as a record selector. This is where it gets confusing. I can get records with no problem, what I can't figure out is how to limit the records the user can select, to what he actually has created. I want to filter his selection options based on his UserID.
I have tried everything I can think of and nothing seems to work. I think the answer lies in the where clause of my SQL statement but it continues to elude me.
example:
Select tblFTEP.[Key#],tblFTEP.UserID,tblFTEP.TraineeID, tblFTEP.DOR,tblFTEP.Date From tbl FTEP Where ???????? ;
What I want the where condition to say is, show only those records that match the UserID that is displayed in Text689 on the main form.
Any ideas? I am just about ready to throw this laptop out the window!
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.
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.
Is there a way to have an expression in the control source of a text box in a report, that re-starts or is exclusive for every group within the report?
I stumbled upon the Option Group function just yesterday and, happy as a clam, I created a group with 2 options in radio button style. I assigned the values to a field called Registration_Type as the 2 options are "Confirmed Registrants" and "Prospective Attendees".
[Great. That part works well. When I look at the table, a 1 or a 2 is in that field so it's great to know how to control accidental ticking of radio buttons (previous 450 records or so didn't have this option group functionality so one might easily tick one of the buttons. So one part of controlling option group I know I can handle via the table itself for now.]
The challenge is how to ensure the user always ticks one or the other ... I went back to the main table and tested the 'required entry' option for the Registration_Type field but forcing an action like this is not ideal in my mind. The usual error message vagueness for the average user is no good and I don't want to limit the user so much.
Is there a way to simply have a popup come up warning that neither radio button was ticked? Perhaps something linked to the form - i.e., maybe "after update"?? I only learned about attaching code to before and after update on controls a couple of days ago, so not sure if this would be best approach.
Just something to let the user know that nothing has been ticked in the option group as that controls in which of 2 reports the data will show up in so any record not ticked might mean a registrant being left out, which would be rather disastrous <g>.
I'm trying to create a Query. I have a field "Name" from the table "Products" and the field "Quantity" from the table "Deliveries". Currently, The same product name will appear several times with their quantities. I want to SUM all of those quantities together and only have the Product name appear once. If it's a diffrent product name, then sum all of it's quantities together etc. I'm having a tough time writing a proper formula, It either has syntax errors or produces more than one field, which I don't understand. I need a formula that I can insert into the design view of the query. This formula will also create a new data field to hold the information. Can anyone help?
p.s. Do I have to use SELECT for both Name and Quantity? Where do I insert GROUP BY? I'm so confused!! I've tried things like (SELECT Name, (SELECT SUM(Quantity) FROM Deliveries) FROM Products....by now where am I supposed to write GROUP BY???
I know you have probably seen this a trillion times, but being new to all this, it is discouraging to say the least! Please help...
I think maybe I should upload the database, let me know.
Here are the names:
Table name: PPM Data
Fields: Company PPM Month PPM Amount
There are 10 different companies, and I need top 6 months data per each Company, to eventually only show the 6 amounts. I have tried all the equations I can find. But I don't think I am doing it right. I have tried to make 10 different queries for each company and than tried to join those queries, and that just didn't work.
I have tried Allen Browne, confusing, and I have tried Acc2002 for their equations for Top N per group, I still can't make out what they are saying without the actual database to look at.
Hi, i have a combo box that query a tabel to get the date's i chose from but she repeat the samedate if i have a 2 records with date 12-9-2005 i see 2 in the combo box ho i can join them to see only one date fron them
I have a field on a table that is a memo field. I am trying to write a query to include this field but get the "Can't group on memo or OLE object. Any ideas on why and how can I query with this memo field included?
I'm trying to view the last two valuations for each property so that they can be compared. I can pull out the last valuation for each property and can pull out the top two records but not for each property, just shows me the top 2 of all records.
Hi, I have just made my maiden voyage on the good ship "Security Wizard" and the water has been a little rough but as yet I still have my sea-legs intact!
Slight problem though... I want users to be able to add data to a table but not to be able to view the whole table if they try and open it in the database window. Now I know reasonable measures would just hide the DB window but I have the threat of Data Protection Auditors looming over me becuase management "forgot" to tell me security was required and it has already been breached before I used the wizard.
Anyway, I did some research on here and I found a method whereby I can set the table so only I have permission to view/add data, then I can get users to add data via a query with permissions set to Owners.
I'm really hoping that someone will come to my rescue and tell me that there's a much easier way than that...
I need to execute this query from an ASP . Net page. I'm connected to an Access 2002 DB.
SELECT tblBudget.GroupCode, tblBudget.GCDescriptioon, tblBudget.Amount FROM tblBudget GROUP BY tblBudget.GroupCode, tblBudget.GCDescription, tblBudget.Amount ORDER BY tblBudget.GroupCode;
If I delete tblBudget.GCDescription and tblBudget.Amount from the "GROUP BY" instruction it does not work.
What I want to do is that in case tblBudget.GroupCode is repeated (e.g. several records with the same group code) I want to display only one line summarizing all info for the given group code.
The image above shows results from a query I've created. However, I need to group the results by Product Id and display a sum of the individual Product Id's. So I should have something like:
Commercial Loan Mr Steve F Cobblestone LNCLCLRE £299,491.33 Demand Deposit Mr Steve F Cobblestone DD033 £7,402.81 Demand Deposit Mr Steve F Cobblestone DD043 £3,929.78 Time Deposit Mr Steve F Cobblestone TD013 £12,195.60 Time Deposit Mr Steve F Cobblestone TD018 £961,924.12 Time Deposit Mr Steve F Cobblestone TD025 £113,483.58
Any ideas how I construct a query to display the results as per above??
i want the query to do this 12/02/2001 02:00 18 12/02/2001 05:00 25
i cant find anything anywahere and its use ids for a chart in which the chart wizard allows grouping by 1 hour and not by more than 1 hour any help will be much obliged
I need to output an HTML table with the following headings:
============================================== Event Title | Event Price | No. Delegates Booked | Total Price ==============================================
How do I group(/join?) the tables to show this data? I'm confident with doing the recordset stuff, it's just that I have no idea how to build a SELECT string, with data grouped into events where the total number of delegates who've booked on that event will be added together.
I am using Access 97 and I am getting very stuck when I am making a group by query.
Basically I have a table which has for engineering jobs (and a few other collums): [id], [Site Code], [Ref Number], [Job Size], [Date Origionated] and [Date Completed]
I then have made a query (called [MG - CWD SLA]) which works out for all jobs between 2 dates, how long they have been running for and if they have met the Service Level Agreeement:
SELECT Sheet1.[SITE CODE], Sheet1.[Ref Number], Sheet1.[Job Size], Sheet1.[DATE ORIGINATED], Sheet1.[JOB COMPLETE], (CalcWorkdays([DATE ORIGINATED],[JOB COMPLETE])) AS Expr1, IIf(IsNull(Sheet1.[JOB COMPLETE]),"Not finished",IIf([Job Size] Like "M*",IIf(Expr1<=10,"Y","N"),IIf([Job Size] Like "S*",IIf(Expr1<=5,"Y","N"),iif([Ref Number] LIKE "ID*",iif(Expr1 <= 1,"Y","N"),"N/A")))) AS Expr2 FROM Sheet1 WHERE (((Sheet1.[Help Desk Type])="CWD") AND ((Sheet1.[DATE ORIGINATED]) Between [Type the beginning date:] And [Type the ending date:])) ORDER BY [DATE ORIGINATED];
I then have made a summary query based on the above query which gives me for every site, between 2 dates; the number of jobs who have met the SLA or not as the case may be.
SELECT [MG - CWD SLA].[SITE CODE], [MG - CWD SLA].Expr2, count(*) FROM [MG - CWD SLA] GROUP BY [MG - CWD SLA].[SITE CODE], [MG - CWD SLA].Expr2;
What I would like to do is for every like outputted by this query, give the number of jobs for this site between those 2 dates, so then for every line of the query give the percent of jobs which met the sla/not met the sla or not finished.
I have been messing around with distinct and I cannot get this to work! Also been trying to do a join or a subquery, but not sure how to integrate this with working with a query based on a query.
I want to run a crosstab query on a table that looks like the below:
ID STORE RECEIVED ITEM RESPONSE 1, 123, 2006-03-30, Name, Tony 1, 123, 2006-03-30, Position, Baron 1, 123, 2006-03-30, Name, Simon 1, 123, 2006-03-30, Position, Mgr 1, 321, 2006-03-30, Name, Sarah 1, 321, 2006-03-30, Position, Analyst
The crosstab query as it stands only pulls back the first and last records as it wont allow grouping on the value field, which in this case is the response field. All other fields are row headings.
The report looks like this: 1, 123, 2006-03-30, Tony, Baron 1, 321, 2006-03-30, Sarah, Analyst
Any ideas on how I can bring back both reccords, eg Group on the all fields? It should look like this: