Queries :: Database Of References - Querying Two Values From Same Field
Aug 23, 2013
I'm quite new to Access and have inherited a database from a colleague. It is a database of references from which we have extracted pesticide active ingredient, pest species and crop species using forms. I am trying to create a query that will allow us to search and return unique active ingredient x pest x crop species combinations (but which will return all instances of this combination).
The complication is that the pest and crop species names are within the same field ('taxa'). They are distinguished by a label ('pest' or 'crop') in an associated field ('PestorPredator'), but a query using 'OR' will only return a crop OR pest, whilst a query using 'AND' will return no records (because something can't be a pest AND and crop).
I want to be able to create a table that shows the active ingredient, associated pest species AND the associated crop species each in separate columns. We have tried a couple of methods, including UNION and UNION ALL....
Database to query. It holds tables for the machines we have and the parts each machine requires. We also have a database of spare machines and the parts that are in them.
Given the nature of the machines, some parts aren't worth trying to pull out singularly, only as part of a set.
I've been asked to put together something queries which of our old parts/machines can be reused.
So I have a table of current machines and their parts and when they were last replaced.
I have a query that says 'Show me all the machines that have parts over 5 years old.' I get a list of machines and their parts
Can I then take that whole list of parts and search the table of spare machines any parts and find that exact list of parts?
I don't mind if the machine has more parts, but it must match that exact set of parts and that set of parts should be contained in one machine.
I've added an example that is a cut down version of what I have:
Basically say we might want to replace the parts in Current machine 10002.
I query CurrentMachines for which parts it has.I then want to use the results of that to query the spares. But I only want to return spares that has all three parts that machine 10002 has.
All I can make it do at the minute is find the spares with any one of the parts that match the 10002 list.
I am trying to perform a search function query in access but am having trouble. I have two tables. One table has a column in which I need to search the contents of this field by referencing data in another field/table. I am able to write the query searching the data manually (not referencing the other table) but can't seem to get the query right when referencing the other table!
this query works = SELECT * FROM Sample_Data WHERE (((Sample_Data.[Affected_Frequencies]) Like "*451.425*" Or (Sample_Data.[Affected_Frequencies]) Like "*451.400*"));
but, i put together a frequency table (Table name = Frequencies) and the column within that I am searching for is called Frequency. im trying to reference Frequencies.Frequency using a LIKE statement.
I have a field in my query which returns results based on a formula that is a function of other fields. The results are: Pass and Fail. I want to make a query that returns only Fail rows. When I enter Fail as the criteria, a parameter box pops up requesting information be entered before continuing.
I have a db tracking vacation times for staff. One of the fields tracks a members vacation start and end dates. I need a way to pull a report to see who is on vacation based on Date() (today).
For example:
A record for John Doe has him start vacation 08/19/2014 and end vacation on 8/28/2014. If I wanted a report that shows who is on vacation today, 08/25/2014, using the date() function), how would I do this?
I am trying to create a database which crosschecks specifications against building codes. My problem is that it's not feasable to put all of the information about a Building into the Room table, though many codes require information about the Building in order to classify the room. How would I count (or list/get details from) a room in the Rooms table, for use in an SQL statement about the Buildings table.If there are up to 5 rooms in the building, do at least 2 rooms contain a fire escape?
My Rooms table contains information about if the room has a fire escape, as well as references its parent Building ID. How would I query the rooms to count the Rooms within all buildings, and subsequently query all Buildings which have less than 2 rooms with fire escapes?I need it to return a list of the buildings which do not conform to this code.
Now this is literally my second day of programming/working with Access, but I've yet to find an answer dispite hours of searching.I think I can adapt it for the 100+ building codes/references I'll need to implement. It would be perfect to find an SQL-only way of doing this, without going into modules etc...
How can I get my form filed to return the results of a query that I have? For example I have my query set to use the month and year that are in my form in a cbo to get the desired results for Balance Growth. I want this Balance Growth result to show in my form field after the year is updated in my cbo. Right now in my Balance growth field on my form I have it linked to the query but it has the #Name? in it. Thanks for any help.
I have a database I took over, that generally uses linked tables to a MYSQL servers on another machine. The Access database uses a machine DSN to connect.
There are many queries that contain references to linked tables using another name. For example, the table is "service unit" but the queries are using "SU" as a reference. I cannot find any database object with that name SU. There are many such tables referenced like this - all uppercase letters, which is a common thing they all share.
Now, the server had a file integrity issue, and now the queries that contained the SU references will not work anymore. I created a linked table and called it SU and but the queries still won't work until I edit the queries, remove the old SU table, and add the new one in. So,
1. Where those table references could have come from, if it's not a linked table? Is there a hidden location on the server, or in the access database that stores another connection method?
2. Why won't simply adding a similarly named database object work the same way? Why must I re-edit all the queries?
Here is my problem, im working on an old 97 database that is being used by a program and sometimes errors occur through the use of the program and certain tables are not updated properly, so instead of doing this manually I want to be able to query this database through SQL and then later down the line put these SQL queries into a program so it will be more user friendly to edit the database.
So when I try and test one of my queries out, access tells me that I cant make changes to the database because it was created in an earlier version. Now I know i can update the database, but if I were to do that the program that is using the database wont work!
So im a little stuck now, will I have to keep editing the database the manual way or is there another option here? Im wondering (for any java heads out there) If I were to write a java program that would query the database and edit the data inside would that work or would I get back an error?
Can anyone tell me how I can query a number field for odd and even number. I have table with a field that contain only number which I would like to query out all the odd and all the even number to be able to print on a report.
I have a field in my query which returns results based on a formula that is a function of other fields. The results are: Pass and Fail.
I want to make a query that returns only Fail rows. When I enter Fail as the criteria, a parameter box pops up requesting information be entered before continuing.
I have a split database and need a field (Combo type) in the table to lookup values from a query in the front end. How do I do this as it doesn't see the querys because the front and back end are split?
The fields are somehow related where values of B (unique) is taken from A(unique). I trying to do an SQL such that if I input a single value A=9 or 6 or 5 or 3 or 1, the following should be the output:
A B 9 6 6 5 5 3 3 1 1 Null
Or in another case where I input a single value A=8 or 4 or 2 the following should be the output:
I use a query to return values between two dates, here's the code I use:
Between [Select Start Date:] And [Select End Date:]
However because my dates are time stamped (they need to be!) the query omits anything on the end date, for example:
Between [01/09/2007] And [05/09/2007] will return values for the 1st, 2nd, 3rd, 4th but not the 5th - because (I think I'm right in thinking this but I might not be!) it only returns values upto midnight on the 4th? so 05/09/2007 13.42pm won't show up because it's after 11.59 on the 4th.
I can't ask people to enter in an extra day because quite alot of people who use our database won't remember and it'll cause alot of problems when they forget and get the wrong figures.
I've tried adding the following: " & "11:59:59""
onto the code but Access says the expression is typed wrong or is too complicated to be evaluated.
I'm using Access 2003 connecting through ODBC. I'm trying to set up an automated query to grab today's data. normally it's pretty easy, all you'd have to do is enter date() in the criteria in an access query. Unfortunately, the date in my database (i can't change this) is in an odd format.
example: april 1st, 2013 = 1130401
Every single date always has that preceding "1" in front of it, then the year, then the month, and finally the day.
I want to always specify the current date whenever the query is run (without having to type it in)
Trying to create a query from a table. This table has some fields with zero all the way down for all the records and i wish for the query to omit the whole field if that is the case.
I have a material usage table that tracks material going into products...Oftentimes the same material will be used and multiple records will contain that material.
I want my query to return only records with unique material used. I'm clicking the "Unique Values" and "Unique Records" property setting but its not working.
Has anyone ever encoutered a problem where when running a query to return a dataset which includes a memo field, the query only returns part of the info contained in the memo field?
Do queries limit the return of memo field data to 255 characters? I have run other queries on other memo fields in the past, and do not recall ever having this problem.
FYI, there is no indexing, criteria or joins/relationships on the memo field - whilst returning other fields, I purley wanna return whatever is contained in the field.
I am using the QBE grid and am writing a select query to select only records with an empty Date Closed Field. The Date Closed field is a Date/Time Field. I am using Access 2003. When I use in the criteria IsNull([DateClosed]) I do not get any records selected which have an empty Date Closed field, have I a bug? and if so please could anyone point me in the right direction.
I have a linked table in my access accdb file to a view on a SQL Server DB.
One of the columns is a date column, where only the time value is important, so it's stored in the default format, like 12-30-1899 12:00 AM.
In SQL Server, I can query records that fall between a certain time frame. It works in Access when written as an ADO query (that's another story), and it also works when I convert the view to a local access table.
But when I query it as a linked server, it will return everything is greater than 12-29-1899 11:59 pm, but when I try to search any date/time ranges on 12-30-1899 nothing is returned. This seems to be a bug in Access.
The reason I no longer use ADO, is that the results would not print. For some reason, when I go to print preview, Access would evaluate the query I'm passing through to SQL Server and throw a syntax error. I miss ADP.
how to query data in my database based on a number of different criteria.I have reached a stage where I can get all the data I need from one query, however I can't figure out how to further query this data to return records from a table with the most recent date only. I have searched the forum, googled and experimented myself but I am running into "Aggregate Function" errors.In this scenario there are 3 tables. tblJobs, tblEquipment and tblInspectionLog. Each tblJobs record can have multiple tblEquipment records attached to it, and each tblEquipment record can have multiple tblInspectionLog records attached to them.
I would like to query the database for what tblEquipment records have been assigned to a tblJob ID and also return only the tblInspectionLog record with the latest Inspection_Date field.At the moment I am able to see tblEquipment records attached to tblJobs, however duplicate records appear due to multiple InspectionLog records associated with the equipment.
I have tried to filter records from tblInspectionLog using the "Max" criteria under Inspection_Date field in my query. This however returns an "Aggregate Function" error.
I have a query that takes a value, Proposalvalue, and depending on the currency, loc curr, it calculates the currency. It gets the currency value from the currencies table and appends to TableB
eg. proposalvalue currency 50000 1
Currencies id Value 1 0.6587
This creates the conversionvalue = 32935 in the TableB.
I have a form that can viewedit the data in TableB.
Using this form, I want to be able to change the proposalvalue and for it to automatically update the conversionvalue.
I have a query which generates a full list of times and appointments for a given day from two separate dates using a right join and enters a "-" in the field for unallocated time slots using an ISNULL function.
I want to refine the query further so that if a single task/appointment is block-booked in multiple adjacent time slots, I only want to return the start time of the first slot, the end time of the last slot and display the task name once.
The intention is that this will be used to create a daily timetable list in an Access (2000) report with the date being specified in a Combo box in a form in which it will be embedded - though I'm not concerned about the form/report design at the moment, only how to do the query.
I've tried several variations of SELECT DISTINCT and using nested queries to no avail.