Queries :: Create A Query That Excludes Yes / No Check Box
Aug 7, 2014
I have created a query for telling me the dates when I need to check driving licenses from my drivers.
I have also made a Yes/No check box for when they are 'Live' employees and another Yes/No check box for when they have left. I need to exclude the records from the query with the 'Left Employment' box checked ('Live' box un checked).
I need to keep the record for 12 months after they leave so I cant delete it.
View Replies
ADVERTISEMENT
Apr 17, 2014
how to return all values in a query when a form critieria is left blank. I have made some progress, the combo box criteria queries were fairly simple, but i'm getting stuck with my date criteria. My query doesn't return null values when I want it to.
I want it to return all records (including null values) if the form OpenFrom and OpenTo dates are blank, and just the values between the selected dates (excluding null values) if the form is completed.
Code:
SELECT qryReportSelector2_Authority.*, qryReportSelector2_Authority.ApplicationDate AS ApplicationDateFilter
FROM qryReportSelector2_Authority
WHERE (((qryReportSelector2_Authority.ApplicationDate) Between Nz([Forms]![frmReportSelector]![OpenFromDate],DMin("[ApplicationDate]","[qryAllCases]")) And Nz([Forms]![frmReportSelector]![OpenToDate],DMax("[ApplicationDate]","[qryAllCases]"))));
View 8 Replies
View Related
Oct 8, 2013
I'm trying to run this query but absolutely cannot figure out how to write it. I have a table of Faculty Contacts and a separate table called "Faculty Courses" which is a table that has the Faculty ID # from Contacts as the foreign key and then all of the courses they teach in any given semester.
I want to run a query that shows me all of the faculty who are teaching in Spring 2014 (coded as 1144) OR Winter 2014 (coded as 1142) AND who are NOT teaching in Fall 2013 (coded as 1138).
In the Query Design Window I have no problem putting in the "Semester" field from the Faculty Courses field and then under Criteria putting ="1144", going down one space to put ="1142" (to make it an "or" operation). I then put in another "Semester" field next to it to make an "and" (maybe I could just type "and" after ="1144"?) and then typing <>"1138".
This however does not eliminate faculty who are teaching in Fall. It will eliminate all faculty who are ONLY teaching in Fall, however it will still return faculty who are teaching in fall, so long as they are also teaching in Winter or Spring.
View 6 Replies
View Related
Jun 20, 2013
I am new to Access and have been hitting a wall and seem to be finding nowhere that has this same type of task.
I have a table(Table 1 ) with 3 columns...
Table 1
I am trying to run a query that returns Table 1 but excludes rows that meet multiple criteria. I need to return rows that do NOT contain the combination of criteria below
Criteria
1) Lot Number - Left([Lot Number],2) = "PT"
2) Transaction Desc. - "Put-away"
Basically, i want exclude a "Lot number" starting with "PT" IN COMBINATION WITH a "Transaction Desc" of "Put-away". The goal is for the query to return ROW2 and ROW3 and exclude ROW1.
ROW1 would be excluded from the query result because it meets both criteria.
ROW2 and ROW3 would be included because it does not fully meet all criteria.
View 3 Replies
View Related
Jan 7, 2015
I have a query that has several checkbox fields. When I open the query it shows the checkbox not the value (see attached 1), when I export the data it comes into excel as TRUE and FALSE. Is there a way I can in the query show the value ie True or False and secondly add some code in the query that takes a True value and makes it say something else like "BOB".
View 2 Replies
View Related
Mar 19, 2013
I am hoping to do a report all my queries in my Database.
I have managed to use some sql code to list the queries which is the following:
SELECT MSYSOBJECTS.Name
FROM MSYSOBJECTS
WHERE (((MSYSOBJECTS.Type)=5) AND ((Left([NAME],1))<>"~"));
But i cant seem to get any further i would also like to include the creation date, the description if any, the tables associated with each query, as i know i have a good few queries which maybe duplicates i just want to clean it up.
View 2 Replies
View Related
Jun 19, 2014
I have a form with a check box. A query is run that looks at that check box and decides what the criteria are based on that. So, if the check box is checked, it should pull in all data in the field that is a Y. If it is not checked, i want it to pull all data (Y's and N's and blanks).
here is my criteria:
IIf([Forms]![frm_Query_Form]![CheckBox]<>0,"Y","*")
This does not seem to work. I have also tried:
IIf([Forms]![frm_Query_Form]![CheckBox]<>0,"Y")
IIf([Forms]![frm_Query_Form]![CheckBox]<>0,"Y",Like "*")
IIf([Forms]![frm_Query_Form]![CheckBox]<>0,"Y","like "*"")
View 14 Replies
View Related
Oct 23, 2013
I have a database used to manage teaching assignments (which kid is assigned to which teacher so to speak). I have this relationship defined through three tables, a teacher table, a student table, both with unique ID's. The third table is used to define the assignment. Also, the kid table has an extra GroupID. The group ID is what is used to define. So in the definition table, Teacher 1 is assigned to Group 1, and so on (though their may be 20 kids in group 1). When a new teacher is added to the teacher table, I need it to add it to the corresponding field in the definition table. The groupID is in the table as an Autonumber so that will populate automatically.
I need to appendTeacherID to tblassignment (TeacherassignmentID) and have only one occurrence of the TeacherID. So, if I have teachers 1-8 listed, each assigned to a group# in the tblassignment, and I add Teacher 9, I need it to add Teacher 9's unique ID to the TeacherassignmentID field without adding 1-8 again. I can't figure out how to "check" for ID's 1-9 and add only those I've added to the teacher list that aren't already assigned to a group.
I've tried a few different SQL queries append/select queries but nothing seems to do what I need it to do....
View 1 Replies
View Related
Sep 24, 2014
I am using the function below to calculate a field that excludes weekends and holidays. The weekends are excluded as it is now, but when I try to add in code to exclude holidays I am getting errors. The code for the holidays is in bold and a couple of the errors are Loop without Do so I remove the Loop then I get a Else without If.
Code:
Option Compare Database
Public Function WorkingDays(Due_Date As Date, Result_Date As Date) As Integer
'-- Return the number of WorkingDays between Due_Date and Result_Date
On Error GoTo err_workingDays
[Code] ....
View 6 Replies
View Related
Dec 18, 2006
Hi,
I am new to the forums, so if i posted this in the wrong section...please accept my apologies...
I am creating a database for recording some information about various customers. There is a date field involved, and if a certain number of days pass from that date, i want to create a button that when it is pressed it will check all the dates to see if this condition is true.
EX
Current Date is 10/21/2006, when i press the button, the database will check to see if 10 days have passed from the date recorded.
User 1 - 10/05/2006 - True
User 2 - 10/10/2006 - True
User 3 - 10/15/2006 - False
Then it would just display the records which are listed as true only. I was thinking of using a query, but i am not sure how to quite do so...please give your recommendations as to what i can do.
THanks in advance!
Kaashif
View 2 Replies
View Related
Jan 23, 2014
I need to get the MAX id from two tables for use in vb.net. For example:
Code:
Table1 Table2
id, customer id, customer
How do I write a query that will return the last or MAX id from both tables based on a customer criteria.
View 5 Replies
View Related
Nov 14, 2013
I have done smoe baisc queries to sort, filter and report on data.How do I create a nested query where I don't repeat all the information across the query results line? Is there a way I can build a nested query to give all the SMCode codes associated with each appointment in one column separated by a coma?I have a table with appointments (APPTS):
RecID
ADate
ATime
Durantion
PVID
Desc
Case#
Then I have a table with Orders related to these appointments (ORDERS):
RecID
Case#
SMCode
SMDate
Here's my query:
SELECT DISTINCTROW Appts.RecID, Appts.ADate, Appts.ATime, Appts.Durantion, Appts.PVID, Appts.Desc, Orders.SMCode
FROM Appts INNER JOIN Orders ON Appts.[Case#] = Orders.[Case#];
My results look like this:
RecID ADate ATime Duration PVID Desc SMCode
RecID ADate ATime Duration PVID Desc SMCode
RecID ADate ATime Duration PVID Desc SMCode
I need my results to look like this:
RecID ADate ATime Duration PVID Desc SMCode,SMCode,SMCode...
View 3 Replies
View Related
Jun 17, 2013
I am relatively new to MS Access. I am wanting to create a query that allows me to search for a computer by name.
I have two fields in the Query. Main user and Computer Name.
I would like it when you open the query it asks you to input and name then once inputted display that persons computer name.
View 1 Replies
View Related
Dec 1, 2014
I have the following tables:
tblOrderDetailsKeyItemIdOrder QtyPO#001A204001002B204001003C304001
tblTransactionsKeyTransDateItemIDReceivedPO#0011/1/2014A1040010021/2/2014B2040010031/3/2014A54001
I also have a table that list the items and on that table the column ItemID is the key.I want to create a query that will list all items ordered on a PO# and how many have been received so far. With that I will calculate the outstanding qty. I want to see:
qryOutstandingPOPO#Item IDOrder QtyReceivedOutstanding4001A201554001B202004001C30030
But all I see is this:
qryOutstandingPOPO#Item IDOrder QtyReceivedOutstanding4001A201554001B20200
It is missing item C because I have not received any yet so there are no records in the Transactions table for it to select.
View 4 Replies
View Related
Nov 6, 2014
I am trying to create a query to append new records from my NEW database into my old excel database.....
The old DB has 4-5 extra tabs that the NEW database does not have so when I append, in those extra columns the new database will just have blank records since the column doesn't exist.
Usually I do a append query in design view. but sometimes it gets funny because it creates duplicates...
How would I go about it, so its quicker and persistent like creating a macro excel.
View 1 Replies
View Related
Jul 24, 2014
I am trying to create a query in Access 2010 for records that don't match based on the following criteria. I have two tables with identical ID's and I need to do a comparison on the amount field between both tables and only return the records from one table displaying all fields plus the amount fields that do not equal. I tried this in the wizard unsuccessfully.
View 13 Replies
View Related
Jul 19, 2013
I am creating a database for users that no nothing about access nor do they want to learn. So the database needs to be as simple as possible.
This being the case I would like to avoid users from creating/editing querys.
I would like to have a form that would run the append query. The query would have a date column and a status column that the query would filter.
The query would have a criteria for status that would equal to "BACKED OUT" and the date would need to link to the two text fields on the form. My problem is writing the VBA code to make the query append in the background.
For sake of argument:
Query = qryappend
Form = frmappend
Table = tblappend
View 6 Replies
View Related
Dec 5, 2013
I have three tables with data.
Table1 is data for meals.
Table2 is data for room costs.
Table3 is data for payments made.
Each of these tables has a foreign key for EventID.I'm trying to produce a report that will show, for each EventID:
The total billed (which is meals + rooms)
The total paid (from Table3)
The balance due (the difference from the two above).
Do I have to create summary queries for each table?
View 2 Replies
View Related
May 28, 2014
I am trying to do a lookup from a field from one of my databases (DB1) onto another field in (DB2).... I have been using excel to do vlookups but a report that I do weekly I do atleast 7 lookups for the past weeks... So I am trying to find a way in access to do lookups and save those lookups each time i run the report... Do I have to create the query and make the ID the primary key on both the databases and then create a relationship?
View 7 Replies
View Related
Dec 24, 2013
How do I create new records based on the results of a query?
I opened the query results in a form then I want to have a button that basically creates new records based off the query data ... is this possible?
View 1 Replies
View Related
Jun 12, 2015
I'm trying to create a checklist in my access database that can be assigned to different companies. Is there a way to maintain a blank checklist so that we don't have to recreate it every time we start working with a new company?
View 3 Replies
View Related
May 29, 2014
I used the wizard to create a find duplicates query. I know for a fact that 15 records are duplicates. I'm getting over 300 records. When I dumped the data into Excel and did a pivot table to count the number of records by account number only 15 had a total count of 2. All others only had 1. Why are the ones with no duplicates showing? I just want to see the 15.
View 2 Replies
View Related
Nov 19, 2013
I can create a select query with a combo box in it by changing the property of one of the fields - making the display control to combo box and adding the values. No problem there.
What I want to do is to be able to create a query dynamically from vba using a CreateQueryDef statement.
The problem is that you can only pass an SQL string to CreateQueryDef, and the combo box values are not part of the SQL code, but are saved with the query (presumably the same way column layout gets saved).
Is there a way to create a query with VBA and include non-SQL layout criteria so I can have combo boxes?
I'm using Access 2002.
View 6 Replies
View Related
May 16, 2013
I need to create a form that using combo boxes selects a product-size-quantity, and then calculates total price.I asume that I create a query to make the calculation from the form, but for the life of me, I can't fathom out how to do it.
View 3 Replies
View Related
Aug 14, 2013
i essentially have 2 table:
1. Table BIC
A list of codes that will be updated monthly, which will be the basis for querying the second table. Approx 100 rows of data.
2. Table Original
A data file obtained from IT where i'll need to sort it to find any codes that are including in Table1. This includes approx ~ 10,000 row of data.
** note, the "BIC" from "Table BIC" can appear in any of the 5 BIC columns in Table Original.
What i need to do is create a query that will:
1. Search the "BIC" from "Table BIC" in all 5 columns of "Table Original".
2. Where it has a hit, it will create new table - for example, the first row of table Original includes the BIC "ABC" in the "BIC 1" column. A query would create table "ABC" and place this whole record (all 8 fields) in new table "ABC". No modification needed.
3. Where two (or more) BIC's from "Table BIC" appear in one record in "Table Original" - the result will only need to be placed in one of the new tables (really doesn't matter which one). For example, Record #4 includes the BIC "ABC" in field "BIC1" and the BIC "DEF" in the field "BIC4". Therefore, a new table would be created (either ABC or DEF) to capture this information.
View 4 Replies
View Related
Jul 16, 2014
Need sorted Query to be used in a Listbox. The attachment shows a made-up view of the objective.
The first column shows the change in value, then blanks for the first column's next rows, until there is a change of value again.
I do something like this in Excel where the first change in value is bolded. This is to make a list box more readable.
View 13 Replies
View Related