Queries :: Pulling Together Several Tables?

May 2, 2014

I have datasets in tables for some price data, which is monthly. Each month there is a list of unique ID codes for the products ("CAP Codes") and then a price for that product ("LM Retail").The table names are simple dates (2010 01, 2010 02 etc) I want to have a query which would create a table which follows the price of each product through the months. All of that would be simple except not all of the products appear every month, so when I set up a simple link between them all it only outputs products which appear every month. Is there a way that it'll keep the products with just some prices - leaving a blank in the table created when there isn't a price that month?

View Replies


ADVERTISEMENT

Queries :: Conditional Query Pulling Data From Two Tables

Mar 6, 2014

So I have two tables:

users
primary key = user_id (AutoNumber)
surname (Text)
forename (Text)
...

user_change
primary key = user_change_id (AutoNumber)
user_id (Number) which relates to the user_id from "users" table
change_type (Text)
action_date (Date/Time)
...

In user_change I record any changes made to the users table.

What I am wanting to do, within a query, is pull basic details from the "users" table (forename, surname, etc.) which is working fine, but also add in SPECIFIC data from the user_change table if it exists.

I want to pull ALL rows from the users table, not just specific rows, and not just rows where my criteria for the user_change table match.

This is the data I want to pull from user_change...

The MOST RECENT action_date WHERE change_type is LIKE "*issued*".

However there won't be a change_type LIKE "*issued*" for everyone - I want it to be included only if it exists.

At the moment my query is ignoring any users who don't have a user_change record with "*issued*" in the change_type value. I'm also getting duplicate user rows where people have more than one value for "*issued*" - I only want the most recent one...

View 7 Replies View Related

Pulling Info From Tables

Nov 8, 2004

I am trying to get an email address from a table by choosing a employee number from a combo box...it is almost working,
however, it is returning the employee number as opposed to the email address...here is the code I am trying to use:

Private Sub Combo0_AfterUpdate()

Dim myConnection As ADODB.Connection
Set myConnection = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = myConnection
Dim mySQL As String

mySQL = "SELECT EmailName .*,[Employees] FROM EmployeeNumber"

myRecordSet.Open mySQL, , adOpenStatic, adLockOptimistic

myRecordSet.MoveFirst
myRecordSet.MoveNext
myRecordSet.Close

Set myRecordSet = Nothing
Set myConnection = Nothing

End Sub


Then, in the section for the command button and the Outlook code, I have:

eMailAddress = Me![Combo0].Value


like I said, it is returning the same value that is in the combo box...if anyone could help, it would be greatly appreciated

View 1 Replies View Related

Pulling Contacts From Two Tables Into Third Contact Table

Apr 29, 2014

Ok, I have 3 tables. One lists a contact in conjunction with the branch of the company and the trips that contact takes. The second lists a contact in conjunction with the branch of the company and which team they work with (may work with many). The third should list their email address and their phone number. Is it possible to pull the contact name and branch of company from tables 1 and 2 into 3 automatically, such that all I have to input into table 3 is additional contact information? If that is possible, is it also possible to only pull each contact/branch of company pairing once (I don't want four entries for Joe Shmoe/Sales, even if he's taken 4 trips)?

Table 1
Branch of Company
Trip Dates
Trip Location
Contact

Sales
4/1/14-4/12/14
Chicago
Joe Shmoe

HR
6/2/13-6/4/13
New York
Jane Doe

Table 2
Branch of Company
Company Team
Contact

Sales
Blue Devils
John Deere

Sales
Jets
John Deere

Sales
Jets
Joe Shmoe

HR
Sharks
Jane Doe

Table 3Contact
Branch of Company
Email
Phone

Jane Doe
HR
jane.doe@company.com
800-555-1234

Joe Shmoe
Sales
joe.shmoe@company.com
800-555-1235

John Deere
Sales
john.deere@company.com
800-555-1236

View 4 Replies View Related

Queries :: Pulling Name Instead Of Associated ID Number

May 13, 2013

I have three tables the tblStudentInfo (holding the persons main data), the tblEducation (holding the students education records) and the refInstution (holding all university's and college information).I am pulling PersonID, name, etc from the tblStudentInfo, education records from tblEducation.

the problem is that in the query it displays the institution ID instead of the Institution name. How do i get the query/rpt to show the name instead of the ID?

On the form Institution this is pulled from the refInstitution table and the ID InstName etc is a combo box 0; 1.0; etc so the display on the form shows the name of the university instead of the ID number.

View 3 Replies View Related

1 Query Pulling Info From Multiple Identicle Tables

Feb 14, 2007

Hi guys.
For my coursework I was told I need complex queries to gian high grades.

This is my problem:
I have many many tables all identicle. They have the same field names just different information on them.
I wanna be able ot query ALL those tables to bring 1 result which I will then make a report out of.

I have tried everything, I fidled with the relationship but can't understand it.

Oh, and the tables have been linked form excel. I know i can't edit it then, but i dont need to.

I would really really apretiate all responses as this needs to be done asap.

Thanks in advanced.

View 9 Replies View Related

Pulling Data From Other Tables Based On Values Entered

Dec 13, 2007

I'm attempting to build a simple database for a martial arts tournament registration. The weight division (Fin, Fly, Heavy, etc.) depends on the age, the sex and the weight. I've tried this several different ways, most recently by using one table called "competitors" with all the entrant's information, and several other tables based on the age class/sex (i.e. I have a table called Age 8-9 Male with the weights and divisions in it, and other tables for the other ages/sex).
So, basically, what I'd like to have happen is a report that will lookup in the correct table the division, based on the weight entered. In other words, for a record where the age is 8-9 and the sex is Male, the report compares the weight to the values in the 8-9 Male table, or if the record is a 12-13 Female, it looks in the 12-13 Female table for the weight, and places the correct division in the Division field of the report.
Probably going about this wrong.....but any help would be appreciated.

View 5 Replies View Related

Pulling Data From Multiple Tables Into One Form Or Report

Dec 26, 2012

I need to pull data from multiple tables in order to show a "financial summary"..Currently I have: Company; BalanceSheet; Debt; Liabilities; Income..All tables have a lot of information (which is why I built them in multiple tables).

I need to build a form where I can use a combo box to select a company from a list.Once selected - I need to the form to pull selected information from each of the above tables. (As well as perform some math functions).I've been struggling with the relationships (They don't seem to make a difference) and I believe I am above and beyond what the wizards will accomplish.

I have read thread after thread but cannot seem to find a specific answer on how to accomplish this.To make matters more complex - Once finished I want to be able to select multiple companies and create a report from the fields mentioned above (IE: pick company A, B, and C and have all of there "current Assets" add up on one report)

This task was originally achieved using an Excel spreadsheet but it has become to confusing for users and difficult to save information for future use.I believe all of my fields are constructed correctly. how to compile the data from multiple tables into one form/report.

View 5 Replies View Related

Queries :: Query Not Pulling Through All Data?

Oct 6, 2014

I am currently trying to pull a query off from a table that needs to have 3 columns side by side, linking to the same ID number. I seem to have managed to do this by making three seperate queries for each column I need, however, when I put it into one query, it is only pulling through the data form the second column (a total of 273 rows), when it should be pulling through the data from the first column (800+ rows).

The SQL looks like thiss:

SELECT [SM_Antennas_DL-1_Q].[Site ID], [SM_Antennas_DL-1_Q].[Antenna Type], [SM_Antennas_DL-1_Q].[Electrical DT], [SM_Antennas_DL-2_Q].[Electrical DT], [SM_Antennas_DL-3_Q].[Electrical DT]
FROM ([SM_Antennas_DL-1_Q] INNER JOIN [SM_Antennas_DL-2_Q] ON [SM_Antennas_DL-1_Q].[Site ID] = [SM_Antennas_DL-2_Q].[Site ID]) INNER JOIN [SM_Antennas_DL-3_Q] ON [SM_Antennas_DL-1_Q].[Site ID] = [SM_Antennas_DL-3_Q].[Site ID];

So the data DL-1, DL-2, DL-3 is from the same database.

View 8 Replies View Related

Queries :: Dlookups Just Pulling First Record?

Jan 19, 2015

I have a dlookup which gets the empid on login - i know this works as i fire a msgbox with this, this is stored in a global variable.

i have the following code running on 'form_load' to set securities however its just using the first records and not the ones linked to the specified accont - i have a second messagebox fire just before these dlookups just so i know the global is correct

Code:
Private Sub form_load()
DontKick = 0
DoCmd.SetWarnings False

[Code].....

The EmpIDLogin is 1786 (my own) and i have pasted a copy of the table in question (well a portion)

its only using the first row of checks to provide permissions.

View 14 Replies View Related

Linked Tables Not Pulling Back Field Data Correctly

Jun 13, 2012

I'm a bit new to Access but have managed to build a very simple database.

I have a main table which I need to add 4 columns onto the end of, the data for which comes from 4 tables linked to it. Below is how they are linked.

Main table------> Table 1
Main table------> Table 2
Main table------> Table 3
Main table------> Table 4

All 4 relationships have a join type of 2 (Include ALL records from 'Main table' and only those records from 'Table1/2/3/4' where the joined fields are equal)

However, 3 of them pull back the correct data when I refresh the Main table, but the 4th one doesn't - which appears to be to be set up in the exact same way. It does bring back data, but it's the wrong data or in the wrong order.

For example, if the related field in the Main table is "Sarah" - It needs to bring back "Programme", but some Sarah's pull through Programme, some are blank and some are another option altogether. Table 4 has no duplicates or typos etc and I've tried deleting it, loading it in again and creating a new relationship but nothing seems to work.

View 5 Replies View Related

Queries :: Pulling TOP DISTINCT Rows In Final Query

Jun 7, 2013

I've got two nested queries. One finds the oldest inspections from an import table, the second compares that query to the main table again and pulls all 'expired' inspections for each Service Order in the first.

These queries are trimmed down for the essential elements of my question. I can post the full SQL if necessary.

queryDoTheseFirst:

Code:
SELECT TOP 18 ImportTemp.[SO ID], ImportTemp.[Inspection Activity],
[Activity Created]+[AddDays] AS [Due Date]
FROM [Priority List] INNER JOIN (ImportTemp INNER JOIN
queryNeededFirst ON (ImportTemp.[SO ID] = queryNeededFirst.[SO ID])
ON [Priority List].Activity = ImportTemp.[Inspection Activity]

[Code] ....

The refinement I would like to make is, rather than having to pull TOP 18 activities in the final query, just pull TOP 12 [SO ID]s and however many activities come along with them (usually 1 or 2, averages out to about 1.5 so 18 is my compromise). In theory an inspector could have two inspections due on every single property, and would only get 9 unique addresses/[SO ID]s. But I can't figure out how to do that when [SO ID] is no longer unique in the second query.

I suppose I could 'number' the rows in the subquery and add a <=12 criteria on that calculated field, but I'm leery of the processing required (that table contains ~14,000 rows, and most methods of numbering seem to want to use DCount).

View 2 Replies View Related

Queries :: Pulling Records Based On Date Of Another Record?

Sep 29, 2014

I have a file of transaction history from the accounting system. All of the payroll cash payments are coded as ZG. Payroll accruals are coded as ZC. I need a sum of payroll accruals by department that have the same date or later than the last payroll cash payment. How do I write that query?

View 1 Replies View Related

Queries :: Pulling Out Weekend Days In Access 2003

Apr 25, 2013

I can't get this to work! I am re-using a database to create new reporting. It was a technician utilization database that I am reworking to show weekend days worked. I changed the date format to Long Date to show the day, then started a query. The query is looking for *Saturday* but pulls nothing in the date field that I just changed to Long Date. What am I missing?

View 2 Replies View Related

Queries :: Pulling Comment Based On User Selection?

Sep 17, 2013

I have a tblCommets that has 2 columns in it. The first is an identifier (1,2,3) and the second column is a comment associated with that identifier. Is it possible to use a query to pull that comment based on a user selection? So, if the user selects 1 then the comment associated with 1 is pulled, but if the user selects 2 then that comment results.

Code : =Select[tblComments].Column(2)

View 1 Replies View Related

Queries :: Unable To Use Between Query Without Pulling Dates Out Of Range

Feb 19, 2014

Unable to use Between query without pulling dates out of range.I

f I set the Criteria to Between [Enter the start date:] And [Enter the end date:] and input the dates 1/2/2014 & 1/15/2014 i'm pulling data for those dates but for year 2011, 2012, 2013 and 2014 as well.

if I enter in Between #1/2/2014# And #1/15/2014# it gives me just the dates I requested.I need to be able to have a user use the macro and just enter in the dates they need data for.

Also, I am using the criteria on a date ime field that I have set up an expression on - CreateDate: DateValue([TABLE]![date])the date in the table is stored with time and I just need to show the date.

View 3 Replies View Related

Queries :: Pulling A Cell From One Table To Another Based On (Account Number)

Jul 22, 2013

Table 1:
Account Number
Start Date
End Date
Cost data**
Budget data**

Table 2 (Imported excel file with cost/budget data):
Account Number
Cost data**
Budget data**

Table 1 is the main table that will be viewable in this database. The idea here is that new Account Numbers can be added to Table 1 throughout the year. It then pulls the cost/budget data into Table 1 based on the matching Account Number between table 1 and 2.

So, if the Account Number (Table 1) = Account Number (Table 2) then it pulls the cost/budget data into the cells on that row. I am trying to make this automated since this data is updated weekly and imported into Table 2 from excel.

View 4 Replies View Related

Queries :: Pulling Records Based On Blank / Non-blank Criteria

Jul 18, 2013

I have a couple different reference files that get updated each week. Sometimes there are missing data elements, so I'd like to structure a select query to show me those records that have blank elements but I'd like the similar records to be pulled in as well, so I can make a determination as to how to populate the blank records..

See attached example: I have a client ID reference table that gets populated with forecast owner names (individuals responsible for the customer) from a couple of different sources. Sometimes there are names attached and sometimes the field is blank.

How can I structure a query to show me just those Client ID's that have multiple entries with blank AND non-blank forecast owners? I'd also like to exclude single/multiple records where there are only blank records...

View 3 Replies View Related

Pulling Data Out

Nov 7, 2005

I have a member roster. I have members who have attended. How do I subtracta list of those who have attended from the roster to find those who havent attended. The only way I know those who have attended is by their sign in date.

View 1 Replies View Related

Pulling My Hair Out

Dec 28, 2006

I have created several Queries and I would like to have a column that numbered the results. I have looked all over saw a couple of samples but havent had any luck. Anyone have any suggestions. Thanks for your help and have a good New Year.

Just to clarify basically this is what I need. Loan Number is the Primary key.

# Column Borrower Loan Number
1 smith 123456
2 jones 023567
3 jang 102569
JW

View 2 Replies View Related

Pulling No Data

Dec 28, 2006

How could I pull in someone when they do not have data?

There is a name table and data table. My goal is that when I run a parameter query if someone does not have data for that time period to have that name pulled in so that eventually a report could be generated stating there is no data for this person for the time period.

View 1 Replies View Related

Pulling Last Record

Aug 2, 2007

I'm trying to figure out how I can pull the most recent entry in a table for each of the properties in our database. Let me give you some background. This access database is used to format reports from an SQL database - all of the tables are linked and all of my other reports work great except for the one I'm trying to create from a table that gets updated every day by way of a stored procedure that runs every night on the SQL server. In my mind this shouldn't make a difference and I should be able to select whatever data I want from this table/query based upon whatevery criteria I want. The field in the table I'm trying to use is a "date stamp" of when it was updated via the stored procedure. I want the last entry made for each property so I selected "last" as the criteria which should get me approx. 20 lines - one for each property. But when I use this I still get back multiple entries for each property. This seems like it would be easy to do but everything I try doesn't seem to work.

That's why I've turned to the experts here for help.

Thanks

View 4 Replies View Related

Pulling My Hair Out...

Feb 6, 2008

I'm certainly not new to Access, but this is the first time encountering a problem like this. I have a table with 3 Field Names, [Return], [Header] and [Date]. An example table looks like so..

Return Header Date
1 | 10 | 1/1/2007
2 | 10 | 3/1/2007
3 | 10 | 5/1/2007
13 | 20 | 6/1/2007
14 | 20 | 7/1/2007

I need to take to have group the Header's together, for instance 10, and have it return the [Date] for whichever line has the lowest [Return] value. I just can't figure out how to do it. Any help or insight would be GREATLY appreciated. I'm 90% done with the project, and this last part will seal the deal.

View 3 Replies View Related

=Date() Not Pulling Nothing!

Oct 31, 2006

I have a field that is updated with =Now()
now when I try to run a regular query with the criteria being
=Date()

I get nothing
And the "=" is always disapearing out of the query.
I dont know what is going on. I got the field set up in the table section as a date field with short format.


Can somone please tell me what I am doin wrong when I have followed instructions up to this point....

View 6 Replies View Related

Pulling Up A Query With ASP

Mar 11, 2007

Hi, I was wondering if someone could check this code over. I am trying to pull a query (titled: Codes_+_Conduct:_General)which was already created in Access. Here's the code: (the red is where the error message I get is)

-----------------------
<%
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.Open connectionstring
Set objRS = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT * from Codes_+_Conduct:_General order by subject asc"
objRS.Open strQuery, objCon
IF rs.EOF Then
Response.Write("<tr><td colspan = 3>No Tips</td></tr>")
Else
Do While not rs.EOF
x = x + 1
%>

<strong><%=rs("subject")%></strong><br>
<strong>Q</strong> <%=replace(rs("question"),vbcrlf,"<BR>")%>
<br><br>
<strong>A</strong> <%=replace(rs("answer"),vbcrlf,"<BR>")%>
<br><br>

<%
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Set objCon = Nothing
%>

------------------

The error message I receive is:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

/faqs2.asp, line 13


If anyone could offer me any help, I would greatly appreciate it. Thank you.

View 4 Replies View Related

Pulling Data From A Table

Dec 11, 2005

I trying to build a usage tracker. Users will take a reading once a week and enter data. I want to open the form and have 2 fields filled in based off the last reading entered into the table. I have an ID field (autonumber) and I tried using that field -1 to populate my other fields but it does not work. any suggestions

jon

View 1 Replies View Related







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