Queries :: Update A Query Based On Results From Another Query Using Count Function

Apr 2, 2013

I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).

I have 3 queries which count how many patients come in 5, 4 and 3 times/week.

In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".

I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.

(I'm not using SQL view, I'm using the query design view)

In the "update to:" row, I use the Build function and locate the count I'm looking for.

Problem: when I run the query I get the error: Operation must use an updateable query.

View Replies


ADVERTISEMENT

Forms :: Using COUNT Function On Subform Which Is Based On Query?

Nov 4, 2014

Doing a school project and need to add a count function to a sub form that is based on my query. The count function just needs to be displayed on the bottom of the sub form showing how many records are in the sub form.

When I do this, the function works all good.

When I add the function to a header or footer, so that it doesn't show a column and repeat itself each time.

View 2 Replies View Related

Queries :: Query Or Function To Update Another Field Value

Nov 21, 2013

Would I use an update query or function to complete my task?

Task: Automatically update [Status] based on DateDiff calculation of [RequestDate] and [DueDate]

Issue: [Status] can be one of 6 values, the user can manually select Review or Completed.

[Status] values: Review; Completed; Due in 24; Due in 24-48; Beyond 48; Over Due

Query: Below is the query I just started to ignore the calculation if either Review or Completed exist.

Expr1: IIf([Status]="Review",[Status],IIf([Status]="Completed",[Status],DateDiff('d',[RequestDate],[DueDate])))If the value from above DateDiff equals to the below, I want to update the [Status] field to the [Status] value.

Due in 24 = (0-1)
Due in 24-48 = (2-3)
Beyond 48 = (greater than or equal to 4)
Over Due= (-1)

View 14 Replies View Related

Queries :: Query Results Based On 2 Form Control Values

Oct 29, 2014

I have 2 form controls one a combobox and the other a text box. The text box select the site (txtLocation) where the user can enter part of the name of the site and all sites with those characters are returned. I've done this by adding:

Code:
Like [Forms]![frmSearchDB2]![txtLocation] & "*"

into the criteria on the Site field in the query design editor.I also want the combobox to have an affect on the query. I want it to query on user status. However if the combobox reads "All Users" I want it to return all status's and all null values. In the criteria field I put:

Code:
iif([Forms]![frmSearchDB2]![cbxUserStatus] = "All Users",like "*",[Forms]![frmSearchDB2]![cbxUserStatus])

It kind of works but no null values are pulled back. Should it be an expression?Do I need to do it in VBA?

View 1 Replies View Related

Queries :: Query / Count And Display Based On Date?

Dec 18, 2014

I am trying to run query on a months worth of dates, have it count based on each day and then display the date and the number?

Table:

field1 - field2 - field 3 - Date

I can run a query one day at a time but would like to run it for the month and get this

12/01/2014 - 15
12/02/2014 - 32
12/03/2014 - 0
12/04/2014 - 12

View 6 Replies View Related

Queries :: Parameter Query Returning Incorrect Results Based On Checkbox

Jul 31, 2013

I have a parameter query that contains information on a list of people and contains 3 checkboxes: alumni, parent, business

In this query, I am trying to use parameters to filter the results based on these three fields i.e.

true, false, true would return all records where either alumni, business or both are true, and parent can be either true or false.

false, true, false would return all records where only parent is true, and the other fields do not matter.

View 2 Replies View Related

Queries :: Update Table With Values From Field Using Results From Select Query

Sep 23, 2014

Let's say Table (T1) has fields F1 and F2. After a massive update to T1, there are some records with F1 = "" because a Dlookup using F2 as criteria to another Table (T2) resulted in a null. I created a select query to show unique T1F2 values where T1F1 = "". The user can use this query to find out which F2 values need to be added to T2.

How do I create an update query that will update T1F1 with values from T2 using the T1F2 results from the select query to again use the Dlookup to T2 (of course after T2 has been updated to contain the missing F2's)?

View 1 Replies View Related

Update Query Based On Another Queries Result

May 14, 2007

I currently have the sql below...
UPDATE tbl_Node_List INNER JOIN qryUpdate_P1 ON tbl_Node_List.Zip = qryUpdate_P1.[Zip Code] SET tbl_Node_List.[Date Sent] = (SELECT [MinOfAudit Date] FROM qryUpdate_P1), tbl_Node_List.[Date Recv'd] = (SELECT [MaxOfAudit Date] FROM qryUpdate_P1)
WHERE (((tbl_Node_List.Zip)="35243"));

but I get an err.msg stating the operation must use an updateable query.

What I am trying to do is update my dates in 'tableA' with the max and min values stored in 'tableB'. I have read some of the posts but still can't quite get it. As always all help is appreciated.

View 2 Replies View Related

Queries :: Update Table Query Populate Cells Based On IIF Statement?

May 6, 2013

I would like to have a table update query populate cells in a field, based on an IIf statement (below), but states that the IIf statement arguments still need to be enclosed in parentheses. I don't understand what the problem is, I have two sets of opening / closing parentheses.

Code:
IIf IsNull (=Mid( [CONTRACTOR_TASK]![TASK_NAME] ,6,6))

View 3 Replies View Related

Query With No Results (Zero Count)

Jun 26, 2006

I have created a query to count the number of records that are "Pending" over 3 days and I am putting the results total on a form. This is working fine when there are >0 records found, but my problem I can't seem to figure out is how to get the form to display "0" in "Text5" when NO results were found in the query.

I have tried everything, but all I get is a blank form when NO results were found. I have attached the database so you can see the sample of what I am talking about. Just run the 2 forms to see the difference.

Please let me know what I am doing wrong or how I can get a Zero Count query to show up as 0 in the text field on the form.

Also there are screenprints here (http://listenloudly.com/AccessDB/samples.htm) of both scenerios:

View 2 Replies View Related

Self Generating Query String Based On Query Results?

Jan 3, 2008

Here's my problem. I need to generate a report that says how much of each individual product was produced and as well as the total produced for a specified category in a time period. Something like the following:

05 Catagory A: 02 Product AA, 01 Product AB, 02 Product AC
10 Category B: 07 Product BA, 03 Product BB
04 Category C: 01 Product CA, 01 Product CB, 01 Product CC, 01 Product CD

etc...

I currently have a query that queries a database and pulls out all products that were produced in a specified period and the categories they belong to and dump them into a local access table. Now what I need to do is search through the query results and count up how many of each product were produced (02 AA, 01 AB, etc...) and the totals for each category. The number of categories is pretty limited (6), but there are hundreds of product codes, so I need a way to do this without having to type in each induvidual product code as the requirement by which the query searches. Also, the product codes that get returned are different every day.

I was thinking something along the lines of take the product code of the first row and check for any others in the results that match and write that into another table. Then move onto row 2 and use its product code as a search parameter and search through the query results for any matches. Then continue that until the end of the query results. Can I do that? Is there a better way to achieve what I need?

View 7 Replies View Related

Count Or Sum Function In Query

Aug 31, 2005

I have designed an attendance database, with fields for personal details and fields for the days of each month.

I need to have a query that will ask for a certain date(i.e. find the specific field) and then search on specific criteria (i.e. ON SITE) to see which staff are available.

What is the best way of doing this? Any help would be greatly appreciated

View 4 Replies View Related

Show Count Query Results On Form

Jan 24, 2006

I have a form that I am trying to show in a text box the results of a count query. The query has two fields in which one is a check box. The criteria for the text box field is set to true to list all that are checked. I want the query to show all the records that are true. This works if I run the query, but the result isn't showing in my text box on the form. On the form text box properties in Control source I have =DLookUp("[Run Number]","Control Room Drumctqry"). Run Number is the field that I am counting, Control Room Drumctqry is the query. Any idea as to what I am doing wrong?
Thanks,

View 7 Replies View Related

Show Count Query Results On Form

Jan 24, 2006

I have a form that I am trying to show in a text box the results of a count query. The query has two fields in which one is a check box. The criteria for the text box field is set to true to list all that are checked. I want the query to show all the records that are true. This works if I run the query, but the result isn't showing in my text box on the form. On the form text box properties in Control source I have =DLookUp("[Run Number]","Control Room Drumctqry"). Run Number is the field that I am counting, Control Room Drumctqry is the query. Any idea as to what I am doing wrong?
Thanks,

View 1 Replies View Related

Count Function In Access Query.

Apr 11, 2007

i'm trying to count the total number of records found for this query. i used the following expression (code) in the QED field row Total Incidents: Count([IncidentID]) which, result in an error message.

Can sum1 help me solve this problem. any help would be highly appreciated.

View 4 Replies View Related

Using Count Function In Totals Query

Oct 4, 2014

OK, I have a database that manages Work Orders. There are 7 statuses that each work order could possibly be in. They are:

0 - NEW
1 - Open
2 - WIP (Work In Progress)
3 - Serviced
4 - Reviewed
5 - Followed Up
6 - Closed

I have several menus for Admin, Manager, Supervisor and Technicians. I have 7 textboxes on each of these menus that are all grouped together to display the count of how many work orders are in the system for each status. I have totals queries for each status that use the Count function to get the total number of work orders, but having trouble knowing how to get those numbers to show up in the text boxes...

The work order table has a lot of fields in it so I won't list all the irrelevant ones here, but the fields that are important are:

WorkOrderT (Name of Table)
WorkOrderID
CustomerID
StatusID

View 1 Replies View Related

Count Function In Query Design View

Jan 3, 2006

I have a query where I want to see a percentage of executed demos. I currently have Name of the promo (group by), # of demos (group by), Status (criteria = E for executed demos, count) and Percentage: Status/# of demos. Everytime I run this query I get this message: "Data type mismatch in criteria expression." The only data in Status is either a O for open or an E for executed. The E in Status is the only criteria I have in the whole query. If I take the count function off Status, it runs, but does not give the right results. Does anyone know what I am doing wrong?

View 14 Replies View Related

Queries :: Differentiate A Query Based On All Group Records Or A Query Based On Only One Record

Dec 22, 2014

I have a combo named cbogroup. I have a tblGroup with several records (active, non-active, nursery, etc.). One of the records is *ALL*. Using the CboGroup the user can pick any of the records. Howeverr, if they pick the *ALL* record, I want the query to pull up animalID based on all records in the TblGroup. If another record is picked (i.e. nursery), then the query will pull up only animalIDs that are in the 'Nursery'.Can I put a (iff then) in a query in order to differentiate a query based on all group records or a query based on only one record?

View 14 Replies View Related

Update Query Results

Dec 16, 2005

Hello,

my problem is, I have a form with a sub-form that displays results of a certain query. Now, on the main form I have buttons that manipulate this query.

What I want is, after the SQL of this query has been changed, the sub-form to show updated query results based on the changed SQL. When I close and re-open the form, the sub-form shows the most recent query results, but I want this without having to close and re-open the form, how?

In the VBA code, I already the "Requery" method of the sub-form but I guess I need to do something with the querydef object, too....

Thanks in advance!

Victor

View 2 Replies View Related

Queries :: Join Results Of Unmatched Query With Matched Query To Include Null

Mar 24, 2013

I am trying to do the good 'ol sales report (query) to include customers with no sales.

I have a customers table, account number table, sales table & sales (line) detail table. (all linked in that order)

If I run a query to show customers (in the customer table) with account numbers, that works

An unmatched query to show customer without an account number works (but of course the unmatched account number field isn't shown).

How can I get the two two be shown together with the "unmatched" having a null or 0 for their account number?

I am guessing in principle, the resulting solution can be modified to show customers without sales alongside those with sales?

View 3 Replies View Related

Query Results Based On UserID

Apr 17, 2008

Hello,

I have a query (used in a combox) with a field called "UserID" and in the query I would like to have the UserID field get it's criteria from the "User" field on a hidden form.

I have it for the most part however, I have two users (myself and another) that when we use the combo box we se "All" the records in the query.
I was thinking something like:

IIf([Forms]![frmUser]![user]= [User],true, "*")


I hope this makes sense.

Thank you

View 2 Replies View Related

UPDATE Table From Query Results?

Jun 9, 2006

Alright, i'm almost sure this isn't the best way of doing this,

But i wanna build a scoring system out of three criteria. cost, delivery, and qaulity. I have those tables built along with a contact table where there over all score will be tallied up. Each contact can have more than one entry in the criteria.

So what I did was i built a query to make a new table for each contact to generate the score and the contact id, then using that ID, i update it to the contact table using the UPDATE function...however wheni have 3 criteria, and 400 contacts..this obviously becomes painfully slow.

The question is, is there a way to directly pull the sql query results (summing the total of each contacts score for each criteria), then storing it into the contact table without making a new table in the process?

View 1 Replies View Related

Pop Message In Form Based On Query Results

Jan 12, 2006

G'Day:

I have tried numerous things to try and create a pop up message or form to alert users of a timing conflict in a scheduling program.
I am not real familiar with codes and am not sure how to handle this.

I used Jason Browne's web site to help me construct a query that will list a result of time conflicts (ie some project is scheduled to occur before another one is completed).
What I need to have happen is the alert message or form opens when this conflict occurs but does nothing when the timing is ok.

I am not very familiar with code and am having a road block mentally. All help is appreciated!

THANKS

View 3 Replies View Related

Locking A Table Based On Query Results

Aug 24, 2006

I have a query that checks an expiration date field and displays the word "Expired" in another field if applicable. This query is used to look up items, then the user would enter whether or not it is approved right in the resulting data grid thereby entering that approval into the table being used for the query. Can I do something with the query so that if the item returned has expired, a user would not be able to enter anything into the approval field? Something like, if field1 = "expired" then lock the table? I can't use a form, I have to just do it in the basic query or forget it. I would very much appreciate any suggestions!

View 1 Replies View Related

Can I Use Sum() Function Along With Update Query?

Sep 19, 2007

I'm trying to use sum() along with UPDATE as shown below

UPDATE ALLDATA INNER JOIN [Total Data] ON ALLDATA.PanNumber=[Total Data].PanNumber SET ALLDATA.PLAForMonthPrevYear = sum([Total Data].PLAForMonth), ALLDATA.CENVATForMonthPrevYear = sum([Total Data].CENVATForMonth), ALLDATA.PLAUptoMonthPrevYear = sum([Total Data].PLAUptoMonth), ALLDATA.CENVATUptoMonthPrevYear = sum([Total Data].CENVATUptoMonth)
WHERE [Total Data].Month=Forms![FORM REPORT]!Combo3;

IT IS THROWING ERROR
PLS HELP ME

View 1 Replies View Related

Update Subform With Query Results In Main Form

Jul 17, 2012

I created a main form containing list boxes and a subform. What I want to do is to select items in the list boxes. Then, by clicking "Search" button, the data filtered by the selected items will be shown in the subform. But the subform cannot work and show the query results. I think I miss some VBA codes.

Complaint Database_William.zip

View 1 Replies View Related







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