Queries :: Use Query Results To Fill In Records In Another Table

Aug 18, 2015

I have a query that outputs results like:

Company ID | Data A | Data B | Data C

101 | results |results |results
102 |results |results |results
103 |results |results |results
104 |results |results |results
105 |results |results |results

In another Table containing additional company information, I have the primary key as the company ID, and I want to make the query that outputs the above table, auto-fill the blank fields in the existing Company information with the same headings as Data ABC etc.

However, I don't want the query to add full new records (which I think is the Append Query?), instead I want the existing company records have additional fields (Data ABC) added, with information from the Query added.

View Replies


ADVERTISEMENT

Queries :: Fill In A Table After Running A Query

Apr 16, 2013

I have now a database where I made a query that will show me all clients I can charge when there is a end date and an account number mentioned. I have also in a table where I put if the client is already charged. This is a check box that gives me yes or no. Is it possible to run the query and once those selected show up, to also add a yes to the table so next time I run the query the ones charged will not be charged again.

View 5 Replies View Related

Fill Form With Query Results

Feb 24, 2005

In the attached db (both 2K and 97 ver) there is one form. Fill in the Date with 12/01/04 and the Start with 12/01/04 and Stop with 12/31/04. Press the Run Query button. The query is displayed...

How can I do it so on button press the form is filled with the query results?

View 1 Replies View Related

Queries :: Duplicate Results For Some Of Records In A Query

Dec 3, 2013

Why I am getting duplicate results for some of my records in a query. I have unique values set to Yes. I have also validated that the tables I am using don't have duplicate data. SQL is below.

SELECT DISTINCT [tbl_Rewards Activity Report - By Member Number].[Member Number],
[tbl_Rewards Activity Report - By Member Number].[Last Four],
[tbl_Rewards Activity Report - By Member Number].[BAL ID],
[tbl_Rewards Activity Report - By Member Number].[Primary Name],

[Code] .....

View 1 Replies View Related

Queries :: SELECT Query Results Inconsistent - Not Getting All Records

Jun 20, 2013

I have a simple select query on a SQL table from Access. The query is:

SELECT tbl_Orders.OrderID, tbl_Orders.Approved
FROM tbl_Orders
WHERE (((tbl_Orders.Approved)=0) AND ((tbl_Orders.Completed)<>0))
ORDER BY tbl_Orders.OrderID;

The strange thing is that sometimes it pulls 34 results, and sometimes 38. From what I can tell, it should be pulling all 38.

What can I do to make sure it gets all the records?

View 2 Replies View Related

Auto Fill Form From Query Results With Button

Feb 28, 2005

Hi all,
I've got another one for ya... I did a search, but must be choosing poor keywords because I can't find the answer I'm seeking.
Anyhoo, what I need to do is use a bit of information garnered from a database to fill in a line of fields on a form at the click of a button on a different database.
I have linked the table I need from the first database, and created the query that grabs the information I need to autofill. So far, so good. What I can't figure out is how to get this information to pop into the fields I want to fill.
I'd like to use a button with a click event to pass the data into each appropriate box (there would be 5 fields worth of info). I need to use a button because it won't always fill in the same line, which of course, adds to the complexity.
Can anyone point me in the right direction?
Thanks in advance,
Ceejay

View 2 Replies View Related

Queries :: Selects Active Records For Three Different Selections - Concatenate Query Results

Nov 3, 2014

I have a query that selects the "Active" records for three different selections, A, B or C.. There may be 1, 2 or 3 results for a particular selection. That is Selection A may have one result or active records, but Selection B may have three results.

I want to use data from the query to populate a field on a form. For example, if the results for Selection A, having one "Active" record would be RecordAData. But for Selection B with three "Active" records the result would be RecordBData & " " & RecordBData2 & " " & RecordBData3

My query is:
SELECT tblSomething.ID, tblSomething.D1, tblSomething.D2, tblSomething.D3, tblSomething.D4, tblSomething.D5, tblSomething.D6, [D3] & " " & [D4] & " " & [D5] & "-" & [D6] & " " & "SomeText" AS Header
FROM tblSomething
WHERE (((tblSomething.D1)=Forms!frmSomethingHeaders!D1) And ((tblSomething.D2)=True));

The concatenation in the query is labeled "Header". I want to be able to Concatenate the "Header" which in itself is a concatenation in the query.

I thought that this might be a looping through the query results, but I cannot figure out how to do it. But then, that is only my uneducated guess.

View 11 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

Queries :: Query That Will Return Records From A Table That Have Related Records In Another Table

Mar 4, 2015

I am looking for a query that will return records from a table that have related records in another table. Opposite to the Unmatched Query Wizard.I have two tables: tblSupplier and tblSupplierProducts.The two tables are related by the field "SupplierId".I need the query to only return Suppliers that have Products.

View 3 Replies View Related

Qry Results Show Duplicate Records, Records Are Not Dup In Table.

Nov 16, 2004

I have built a qry that initially shows the correct information. For example.

tblContent has 289 records with a Type = Class.

I built a Query to select from tblContent Type = Class and I get 289 records. I add additional criteria of Progress <>"Not Scheduled", I then get 206 records. I then add additional criteria Last Name <>"Demo" And <>"Care" And <>"Support". This brings up 200 records, but the query appears to duplicate each record 3 times. I do not have 3 of the same types of records.

The SQL Statement is below

SELECT tblProfile.LoginName, tblProfile.FirstName, tblProfile.LastName, tblProfile.Organization, tblProfile.CostCenter, tblContent.Title, tblContent.Type, tblContent.Code, tblContent.[Date Assigned], tblContent.[Date Started], tblContent.[Last Accessed], tblContent.Progress, tblContent.[Date Completed]
FROM tblProfile INNER JOIN tblContent ON tblProfile.LoginName = tblContent.LoginName
WHERE (((tblProfile.LastName)<>"Demo" And (tblProfile.LastName)<>"Care" And (tblProfile.LastName)<>"Support") AND ((tblContent.Type)="Class") AND ((tblContent.Progress)<>"Not Scheduled"));

The qry is named qryPhysical Class. I have provided the link to view the database. Can you help me?

http://briefcase.yahoo.com/turnerbkgabrobins

Thank you in advance for your assistance.

View 1 Replies View Related

Queries :: Auto Fill Table Field

May 7, 2014

I have been away for Access for a long time and having issue with making a query. I have 3 tables. "tablEmployee" has employee ID, first name, last name and sizer ID. "tblproduct" has product ID, Description and rate. I made a new table called tbldata which has date, product code, product description, product rate,employee id, employee sizer id, and lbs. I want a query when I enter the product id in tbldata, query auto fill the product description and rate. also same as employee.

View 3 Replies View Related

Queries :: Number Of X Results In Last Y Records

Jul 29, 2014

I have a table with:

A dDataID (sequential auto-number)
B dDateTimeEntered (date/time field)
C dFactoryOrder (text)
D dSpecificationID (number)
E dStartWeek (text)
F dIncreasingDecreasing (text, values are limited to "Increasing", "Decreasing", or "NA")

I need a query to look up the last 9 values where C, D, and E match variables from a form, then tell me how many "Increasing" values are contained within that set. I want to store the final value in a combo box on the form. I tried writing the code and this is what I got - design view attached as a pic and SQL below. It looks like the "Top 9" is sorting on the Expr1 field, which isn't what I want, but I'm not sure how to force it to use dDataID or dDateTimeEntered to figure out which records to use.

SQL:
SELECT TOP 9 Sum(IIf([tblData]![dIncreasingDecreasing]="Increasing",1,0)) AS Expr1
FROM tblData
WHERE (((tblData.dFactoryOrder)=[Forms]![frmDataEntryDisplay]![dFactoryOrder]) AND ((tblData.dSpecificationID)=[Forms]![frmDataEntryDisplay]![dSpecificationID]) AND ((tblData.dStartWeek)=[Forms]![frmDataEntryDisplay]![dStartWeek]));

View 8 Replies View Related

Queries :: Update Query (table To Table) Not Updating All Records

Nov 26, 2013

I'm using an UPDATE query to update records in one table (tblMain) from another table (tblTemp)

Here is my SQL :

Quote:

UPDATE [tblMain]
INNER JOIN [tblTemp] ON [tblMain].[MainField1] = [tblTemp].[TempField1]
SET [tblMain].[MainField2] = [tblTemp].[TempField2];

I only want to update the records in tblMain which have a corresponding record in tblTemp (linked by MainField1 / TempField1)

If any record doesn't appear in tblTemp, I want tblMain to retain the existing value for that record.

However, it appears that in such situations, the record in tblMain has it's MainField2 value set to null / ZLS.

I've tried using LEFT JOIN and RIGHT JOIN and also tried WHERE clauses but the result is the same every time.

View 3 Replies View Related

Queries :: Fill In Checkbox After Running Query

Oct 10, 2013

I have a query that produces a report for charges to the client. On the form I have a checkbox that when the client is charged it is ticked. What would be better is that when I run the query to export to excel, it should check all those checkboxes and the ones that are blank, fill them in (tick the box). Then I need to add to the query that that field should contain only blanks so it will show me only the ones that where not charged and then after producing the report check those boxes so it keep track of all the clients charged (to avoid double charge).

View 3 Replies View Related

Queries :: Excluding Records From Search Results That Have Fields With No Data?

Aug 6, 2015

I have a search form with 12 fields. In my query I use

Code:

Like "*" & [Forms]![CustomerRetestDatabaseSearch]![RetestLocation] & "*" Or Is Null

for each field on the search form.

I get the results I expect, it finds all records that match the criteria. Even if some of the fields in a record are null.

But if the query finds a record that matches one field I enter criteria into, and nulls for the other fields I enter criteria into it displays the record. I want to show exact matches. (If what I entered is null... don't show the record).

The reason I have "Or Is Null" is to include the records for the fields I left blank on the form.

Search Form with Criteria.PNG

Search Query.jpg

Search Results With Missing Entered Criteria(Dont Want These Records Included).jpg

View 2 Replies View Related

Queries :: Query To Count Corresponding Records In Another Table

May 3, 2013

I'm trying to do a query to count corresponding records in another table. It works except for returning zeros. I've tried using NZ and switching the type of join, but to no avail.

Here's what I have:

Query A has 3 columns (FU kids)
AlphaID
DtcCtr (a Location Code)
DlsDtc (a Date of change)

Table A has many columns, but I'm only using a few. (dbo_MNCPSTNote)
AlphaID
DtcCtr (the same Location Code)
ServDate (the date I'm trying to count)

Here's what I have:

SELECT [FU kids].AlphaID, [FU kids].DtcCtr, Count(dbo_MNCPSTNote.ServDate) AS CountOfServDate
FROM dbo_MNCPSTNote RIGHT JOIN [FU kids] ON dbo_MNCPSTNote.AlphaID = [FU kids].AlphaID
WHERE (((dbo_MNCPSTNote.Center)=[FU kids]![DtcCtr])) OR (((dbo_MNCPSTNote.ServDate)>[FU kids]![DlsDtc]))
GROUP BY [FU kids].AlphaID, [FU kids].DtcCtr;

I want to know the count, including zero, of the number of records based on ServDate for each AlphaID in Query A.

I didn't create the tables and have no control over how they are designed/organized.

View 6 Replies View Related

Queries :: Query To Determine If Records Already Exist In Table?

Jan 26, 2014

I have a file that I want to import on a daily basis and append to an existing table in my database. The date changes each day. I want to create a query that checks to see if the date (of the first record) already exists before I import and append the new file. If it does, I want to show a message saying something to the effect of "This file has already been imported".

View 12 Replies View Related

Queries :: Query Criteria Excluding Table Records

Jul 23, 2015

I want to run a query on a table that holds all speed information for our trucks imported from a third party. Some of the speed alerts in that table are not correct so we set up a second table managed by the users to enter a speed exception. So if we know that Main St in Dallas TX generates false alerts for speeding we know not to call the driver, the third party db speed limit is not up to date.

So I want my query to pull all the speed data from tblSpeedData, except leave out the records where the street and zip are listed in the tblSpeedExceptions.

View 3 Replies View Related

Queries :: Use A Query To Select Specific Records From Table

Dec 14, 2013

While I am not new to Access, I am not well versed in its abilities as far as combo boxes go. What I have is a Form where a combo box allows you to pick from a table records 'record ID #' in order to fill in the data of that record to the rest of the form.What I want to do is use a query to select specific records from this table and allow the combo box to show only these 'selected Record IDs' for user selection.

View 1 Replies View Related

Queries :: Lookup Records From Table - Adding A Value To A Query

Feb 12, 2014

I have a query which looks up records from a table, now what I would like to do is append the word All Projects to this query - is it possible, and if so how?

View 7 Replies View Related

Queries :: Update Query - Add Records To A Join Table?

Apr 11, 2013

I have 2 tables that are joined by a many to many table:

tblProductInfo
- ProductID

tblProductLinerMM

- PLProductID (FK to [tblProductInfo].[ProductID])
- PLLinerID (FK to [tblLiner].[LinerID])

tblLiner

- LinerID

I have a range of products that each use 2 liners. An inner liner and an outer liner. I need to add 2 records per product to the tblProductLinerMM table.

for example

tblProductInfo has the following records:

- 2138557
- 2378954
- 4387657

tblLiner has 2 liners in particular that relate to these products:

- L5475
- L5468

I need to create the following records in tblProductLinerMM preferably with the use of a query :

- 2138557 | L5475
- 2138557 | L5468
- 2378954 | L5475
- 2378954 | L5468
- 4387657 | L5475
- 4387657 | L5468

View 1 Replies View Related

Queries :: Write Records From Field Of Query To Irrelevant Table?

Apr 28, 2014

I have a query with many fields. One of them is the combination of two fields and is called "Components Reference". What I try to do is, every time this query is updated, the records of only this field "Components Reference" to be written to the field of another table which also takes records from an another query. I wish I was clear enough.

View 13 Replies View Related

Queries :: Query For Inserting Random Records Into Temporary Table

Jul 16, 2015

I'm trying to insert 10% of a dataset from dbo_billing into another table Random_Temp. Another form is open when this query is to be ran that passess in the billyear and billmonth... I'm sure it's a syntax issue as I can isolate the random number part and it displays the appropriate data, I just can't re-write it to insert into the other table:

INSERT INTO Random_Temp ( indx, peopleId, audited )
SELECT TOP 10 PERCENT b.indx, b.peopleId, b.audited
FROM dbo_Billing AS b
WHERE (((b.billYear)=[Forms]![billing]![billyear]) AND ((b.billMonth)=[Forms]![billing]![billmonth]) AND ((b.recertifying)=-1))
ORDER BY Rnd(-(1000*b.indx)*Time());

View 2 Replies View Related

Queries :: Query Multiple Records Between (Weeks) Where No Record In Child Table?

Jul 1, 2014

I am trying to determine the best method for how to handle this query using Access 2013. I have a clients table that contains the following:

clientID fName lName admissionDate dischargeDate
1 John Doe 05/06/2014 06/27/2014
2 Jane Doe 04/24/2014 05/15/2014
3 Steven Smith 05/15/2014 NULL/Empty
4 Chris Davis 06/12/2014 NULL/Empty

Then there is a WeeklyProgressNotes table that is there for the person that is responsible for auditing the clients charts. It does not contain the actual weeklyprogressnotes, it only contains a Yes/No field and a date field for the date the weeklyprogressnote was completed. Like below:

noteID completed dateCompleted clientID
1 yes 05/08/2014 1
2 yes 05/14/2014 1
3 yes 04/25/2014 2

I am creating a form that the auditor can open to determine what weeks she needs to check for each client to see if they have their weeklyprogressnotes completed that week. The weeks run Mon - Sun and there will be no record in the WeeklyProgressNotes table if she has not yet checked and confirmed for that week. So the form would basically look like this:

fName lName week completed date clientID(hidden)
John Doe 5/19/14-5/25/14 Checkbox Null 1
John Doe 5/26/14-6/1/14 Checkbox Null 1
John Doe 6/2/14-6/8/14 Checkbox Null 1
John Doe 6/9/14-6/15/14 Checkbox Null 1
John Doe 6/16/14-6/22/14 Checkbox Null 1
John Doe 6/23/14-6/29/14 Checkbox Null 1
Jane Doe 4/28/14-5/4/14 Checkbox Null 2
and so on.......

I have thought about creating an SQL statement to select all of the clients and then creating a function that determines their admission date within the specific week and their discharge date withing the specific week and then create a loop with another SQL statement with a BETWEEN clause for all the weeks and determine if there is an entry in the WeeklyProgressNotes table or not. If not then I would display out the above info. I'm not sure if there is an easier, less search intensive way of doing it. Maybe an SQL query that can cut done on some of the looping.

View 5 Replies View Related

Queries :: How To Write A Query Which Selects Multiple Records From A Table At Once For Updating

Aug 14, 2013

I have a list box whose data is inserted in a table named as "test0" ,now in a macro of vba i want to select all the items in the list box and create there pdf files in a folder at my desired location. So far i have managed to create a pdf file of single item ,but i want to select multiple items at once ,

Code:
SELECT test0.ID, test0.item FROM test0 WHERE (((test0.item)=[ItemNumber]));

So, in this query itemNumber are multiple and i want to create there pdf files at once ..just on a click of one button ?

View 2 Replies View Related

Queries :: Unable To Make Crosstab Query To Filter Records From Table

Sep 17, 2013

I am trying to make a crosstab query to filter my records from my table.

Here is the scenario.

I want to make a query that will return me my Rep ID, Rep Name, his Bonus and his GV-Q (another value) based on every month.

Now I make a crosstab query and here is the syntax.

Code:
TRANSFORM First([TBL Qualification Data India].[Bonus Rank]) AS [FirstOfBonus Rank]
SELECT [TBL Qualification Data India].[Rep #], [TBL Qualification Data India].[Rep Name]
FROM [TBL Qualification Data India]
GROUP BY [TBL Qualification Data India].[Rep #], [TBL Qualification Data India].[Rep Name]
PIVOT [TBL Qualification Data India].Period;

This resulted in a column for Rep Number, one column for Rep Name and columns for all the period of Bonus I am going to have., so there are basically 9 columns for this till this month for each month and bonus value shows as values for all these month (period) columns.

Now in this same syntax, I want to have my Rep GV-Q value as well as his bonus to show in the same query, I read and came to know that it's not possible to directly have two values or two column headings in a crosstab query, I must have to make a new crosstab query and then use a normal select query to display records from these two crosstab queries, so I went ahead and made a new similar but with one value field changed crosstab query and here is the syntax for that.

Code:

TRANSFORM First([TBL Qualification Data India].[GV-Q]) AS [FirstOfGV-Q]
SELECT [TBL Qualification Data India].[Rep #], [TBL Qualification Data India].[Rep Name]
FROM [TBL Qualification Data India]
GROUP BY [TBL Qualification Data India].[Rep #], [TBL Qualification Data India].[Rep Name]
PIVOT [TBL Qualification Data India].Period;

Now after this how to make a select query to show the data from these two queries.

I can make a normal query based on these two crosstab queries and manually add all fields and then I would have my result but then after every month I have to manually enter these two extra month details from both crosstab queries to my final query and that's not what I want.

Is there any method to do this by gathering data from these two queries into one and achieve the result I want or if there is any other approach to tackle this.

To explain my database and my need for output, I am attaching few pics to make things easier if I made some mistakes in explaining my problem. It's included in attached zip since I am not able to post images or links.

View 5 Replies View Related







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