Help Needed Please: Date Parameter In Query - Leaving Blank To Include All Records??
Aug 9, 2007
Hi
Bit of an Access beginner and am trying to sort something out for work - not sure why they've asked me!
I've created a query to search on a couple of items using drop down boxes on a search form I created. This bit of it works fine, I used this site http://www.fontstuff.com/access/acctut08.htm and copied what he had done. This is fine.
I now want to add a date search to the same query. I know I can use Between [..] AND [..] but if I leave the boxes blank it finds no records. I'd like it to search and include all.
Ideally I want to include 2 extra text boxes on my form that I can put a to and from date in (or not put a date in and it find everything).
Hope that makes sense, please can someone do me an idiots guide?
Many thanks
Phil
View Replies
ADVERTISEMENT
Apr 30, 2007
I am trying set up some criteria for a create table query. I am using multiple fields from different tables, I am trying to delete certain feilds if they meet the criteria. I am using iif([letter c_last]=[letter a_last],null,[letter c_last]) in the criteria for letter c last, but when I run it a box appears to enter criteria for the last name field? I want it to look at the field not for data to be entered manually. I hope this makes sense. Any help would be greatly appreciated.
View 1 Replies
View Related
Sep 6, 2006
I have a form that allows users to search the database for records based on there criteria. The form allows the user to search, through combo boxes, by variables. The first is MAT, the second is Relocation Area. The search works fine when the user selects options form the combo boxes. However sometimes it is neccesary to leave the location field blank and only search by MAT. When the location combo box is left blank no records are found. Is there anyway around this. The SQL code for the query is below:
SELECT [Extract Data].[ID], [Extract Data].AREA, [Extract Data].[MAT], [Extract Data].[Relocation Area 1], [Extract Data].[Relocation Area 2], [Extract Data].[Relocation Area 3], [Extract Data].[Grade Score]
FROM [Extract Data]
WHERE ((([Extract Data].[MAT])>forms![Data Search]!SearchMAT) And (([Extract Data].[Relocation Area 1])=Forms![Data Search]!SearchArea)) Or ((([Extract Data].[MAT])>Forms![Data Search]!SearchMAT) And (([Extract Data].[Relocation Area 2])=Forms![Data Search]!SearchArea)) Or ((([Extract Data].[MAT])>>Forms![Data Search]!SearchMAT) And (([Extract Data].[Relocation Area 3])=Forms![Data Search]!SearchArea));
Any help would be much appreciated
Nick
View 3 Replies
View Related
Feb 26, 2007
Hi guys, I have a query that displays records that fall between 2 dates (using 2 input text fields). How can I make it dispaly all records if the user just leaves the dates blank?
I've searched through some forums and found that I can make this happen by using IS NOT NULL. But when I tried putting it in the OR row in my date field (and all other places), the result is that the query displays all records that have a date value regardless of my other filters.
Can anyone point me in the right direction where I should actually place the IS NOT NULL? I attached my Query view for easier understanding.
Thanks a lot!
View 6 Replies
View Related
Mar 13, 2007
OK, I have been searching around on the fourm for over an hour now...I give up. If this is some where else, I am sorry.
I have a database of maintenance data. There are several columns that are usually filled in, some records have some columns blank. They are formated text because they hold letters and numbers (see pic).
I am using a form to query the table...no problem. The form has text boxes the user filter down the data
The problem comes are with the results of the query. Any record that has a blank column is not retuned. I am using "Like" so that the user can enter in partial codes. I know "like" won't return "null" records.... Help!
Things I have tried:
1)IIF(form field is blank, return table field, else use like command to filter) - returns nothing!
2)Like "*" & [Forms]![Fleetwide_data_Request]![MAL_CD] & "*" returns all records without blanks (i.e. missing data)
what else can I do?
Thanks
View 5 Replies
View Related
Jul 10, 2014
I am setting up a database to hold staff details, and would like a query to show each member of staff's total hours and FTE.
Staff name etc is in tblStaff
Staff shift details are in tblShifts linked via staffID
tblShifts will contain details of the shift worked on each day of the week, but the majority of our staff work a standard shift - e.g 8-4, 9-5. Therefore what I wanted to do was in tblStaff set a field named shiftPattern to 1 2 3 or 4. 1 indicating a custom shift, and any other number indicating a set shift defined in a separate table.
The problem I have is that my query only returns people who have details in tblShifts - regardless of their shiftPattern value. If I enter a blank record in tblShifts it will do the above as intended.
View 7 Replies
View Related
May 4, 2008
I have a table with a string field for a street. It might have data such as:
Bleeker Street
or Bleeker St.
I want to create a query that will enable the user to search for a string by entering a parameter. Is there a way to construct a query using wildcards for a string so that if the user types in "Bleeker" both the above values will be returned?
Thanks.
View 2 Replies
View Related
Sep 5, 2007
I made a Table with one record per person which is entered initially and contains a sub-table which is a list of the drugs they are taking. As people are notoriously bad at spelling drugs they select them from an alphabetacised drop down list held in another table. The idea being that they check the spelling before entering them on the main table for any new drugs. The subjects each come back and have a number of measurements taken on a number of visits.
So the main table and the drugs table have a one to many relationship and the main table and the visits. In both cases the tables are linked by the same unique identifier which is compulsory and unique in the master table. The data is input using a master form and sub-forms.
I havent done any of the input but when I looked at the two sub-tables they each have a number of records which are blank in the identifier feild.
How has this happened? How do I stop it happening and is there any way of finding out which record these visit data and drugs should belong to?
View 5 Replies
View Related
Feb 27, 2006
Hi all,
I've searched the forums but can't seem to find anything similar. I work for social services and we have a database that stores information on children who may need services from adults when they reach 18.
What I need to do is create a query (so that a report can be run) that will show those children who will turn 18 during the year Apr 1st - Mar 31st but I'm not sure where to start. Can anyone offer any pointers please?
The fields within the database are:
Client ID, Name, Surname, Date of Birth, Address
Many thanks
View 3 Replies
View Related
Apr 11, 2007
i am trying to update a field within a table. But i dont want to update the whole of the data within the field just one part of it.
The field is the Tutor Group for students in the format 7B, 7D, 7F, 7H, 7M, 7S, 8B, 8D, 8F,... etc where the number represents the year group! i want to use an expression that would add(+) 1 to the year group but leave the letter the same as this doesn change. By doing this the above list would change to 8B, 8D, 8F, 8H, 8M, 8S, 9B, 9D, 9F, ...etc
I attempted to use the following expression: ((*)+1)(*) but it didn't work.
I should have had the year groups separate but i am given an Excel flat file which has details of the students and doesnt separate the the two.
any help would be much appreciated! hope someone can help!
View 5 Replies
View Related
Apr 23, 2007
I have the following tables: Rates and SelectedDates, which are structured as follows.
Rates: RateID, EffectiveDate, Rate
SelectedDates: Date. Table is bound to a combobox in which user selects one or more dates, mm/dd/yyyy, which is the same format as Rates.EffectiveDate.
I need a query to return the first Rates.Rate for the following conditions. (there will be a minimum of one record in the Rates table)
IF there is only one Rates.EffectiveDate for the SelectedDates.Date
return the associated Rates.Rate
ELSE IF count(Rates.EffectiveDate <= SelectedDates.Date)>=1
return the first Rates.Rate where Rates.EffectiveDate <= SelectedDates.Date
ELSE
return Rates.Rate associated to the Rates.EffectiveDate closest to the SelectedDates.Date.
I hope this is clear, as it is late and I am tired...:confused:
Thanks in advance,
Rod
View 1 Replies
View Related
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
May 30, 2006
Hello,
I have got a serious problem with parameter searches. What I want are multiple field parameter searches in one query. I created a new query, and set the criteria to Like "*" & [...] & "*" for at least 5 fields. The problem now is, that the number of records get less the more parameter searches i create for different fields.
I tried to put the parameters into the "or" criteria but it still does not work!
please give me a hint.
Thank you!
John
PS please ask me when you did not understand my question.
View 1 Replies
View Related
May 30, 2006
Hello,
I have got a serious problem with parameter searches. What I want are multiple field parameter searches in one query. I created a new query, and set the criteria to Like "*" & [...] & "*" for at least 5 fields. The problem now is, that the number of records get less the more parameter searches i create for different fields.
I tried to put the parameters into the "or" criteria but it still does not work!
please give me a hint.
Thank you!
John
PS please ask me when you did not understand my question.
View 1 Replies
View Related
Jan 5, 2007
Hi All
Is there something I can write in to a query which will tell me whether the 1 April 2006 appears in between two dates (which are entered by a user?)
For example, if they put the first date (which is one field) as 25/3/06 and then they put the end date (which is another field) as 4/4/06 - I just want the query to produce the word "yes"?
Thanks
Maria
View 6 Replies
View Related
Oct 1, 2014
I have a query with three sub queries, all returning a number from different tables. But when any one of the sub queries returns a blank, the entire main query is blank.
How do I stop this from happening? I have tried NZ() on the sub queries and on the main query, but the blank still happens.
View 1 Replies
View Related
Feb 13, 2005
Hello
Once more I'm desperate:
The most "stupid" thing happens when I close a form of mine:
A message box appears asking me to give a parameter value for a combo box that is included in my form. That combo box is used to find specific records in my form. It works perfectly, but the only problem that creates is that mentioned above. Why is a parameter value needed (only when I close the form)? The funny thing is that if I load the form and not click or update the combo-box, when I close the form everything works fine. I checked the vb-code a million times and there's nothing odd in the "after update" code. I must mention that when that msg box appears, whether i give a value to that message box or not,the form closes normally, without anything affected. But it's very annoying. If we could just by-pass that msg box, or eliminate the cause that makes it appear.......
Pls help.....
Thank you in advance
View 10 Replies
View Related
Nov 23, 2006
Hi everyone,
i am quite a begginer at this so sorry for the simple question
I am running a access query from a vba code. IN the vba code I am writing the sql command.
I am getting the criteria for the sql code (WHERE command) from a number of combo boxes in a form.
The whole thing works quite well when I have something selected on all combo boxes but it does collapse when one of the combo boxes has the default value which is "" nothing.
for instance when I have
WHERE domicile.IdDomicile = 5
works fine. 5 comes from the combo box
when there is nothing selected in my combo box the sql code would be
WHERE domicile.IdDomicile =
and then I get an error msg saying the query is wrong.
Question,
what is the command in sql that instruct the query to return all records.
I tried using "*" when the combo box was not selected but then I dont get the records that are blank, only the ones with something writen in it.
Any other suggestion for this
Many Thanks
K Regards
View 4 Replies
View Related
Jun 24, 2013
I have two tables: Table #1) [Request Table] Customers request our company to stock a certain Part Number with a minimum value. Ajax - P/N "NP4i" - Min "30".
Table #2) [Sales History] All sales purchased and the "Qty-Total" purchased. For simplicity Fields are limited.I created a CrossTab Query that displays from [Request Table] P/N's requested/ min values (Row Headings) then showing P/N's purchased [Sales History] Value="Qty-Total" Sum and
Column=Format([Invoice Date],"mmm/yyyy") group by, showing last twelve months.
Ex: Customer name, Part Number, Minimum, May/2013, Apr/2013, Mar/2013 and so on.
AJAX, NP4i, 30 4 21 5 and so on.
The Crosstab query list only requested Part Numbers that have at least One sale wihin the last twelve months.If there are NO sales, the crosstab query will NOT show this Part Number.My boss wants to see the requested Part Numbers that were never purchased along with the ones purchased.He wants to address the NO sales, yet they requested we stock that particular Part Number for them.
Is there any criteria I can use to force the Part Number field on the [Request Table] side to populate even though there were NO sales within the last twelve months?
View 1 Replies
View Related
Oct 8, 2007
Hello.
I have a query that is pulling data based on a date in a table. For some records, that date field is empty. For those records, the data should be pulled based on the date of 1/1/06. I tried doing this
=IIf([Signed SLA Received] Is Null,1/1/06,>=[Signed SLA Received])
It doesn't like this at all, it brings back no data. I also tried putting 1/1/06 in quotes, but it didn't make any difference.
This is probably a totally incorrect way to get this done, but I don't know how else to try it.
Thanks!
Stacey
View 3 Replies
View Related
Aug 3, 2007
I have an EndTerm field (this is a calculated field); I want to set up a parameter query that enables me to type in a date which will retrieve any records BEFORE that date. I've used < [Enter date] and results were not right. i.e., I entered 1/1/2007 in the parameter and the results came back with records dated 1/1/yyyy instead of anything before 2007.
View 7 Replies
View Related
May 7, 2013
I have a Continuous form where I am trying to add a calculated feild that allows us to see how many days a client was in hospital. There is a start and end date. I want to see the following: If start date and end date are the same, this should show client in hospital for 1 day, not the default of 0. If start date 5/1/13 and end date is 5/3/13 it should show 3 days in hospital. If start date is 5/1/13 and there is no end date, this should show 7 dates (from start date to today's date or current date). Currently I have
=DateDiff("d",[EStartDate],[EEndDate])-([EStartDate]=[EEndDate])
but it only shows 1 if the start date and end date is the same. I need it to include the start and end dates typed in its equation.
View 1 Replies
View Related
Nov 20, 2007
Hi,
i've got a query that is linking 2 tables.
i'm having problems with the join properties.
basically from what i can understand, there are 3 options.
1. Where join field from both tables are equal
2. All records from table 1 and only those from table 2 where they match
3. All records from table 2 and only those from table 1 where they match
how do i go about having all records from both tables showing?
View 10 Replies
View Related
Sep 13, 2005
Hi,
I hope someone can help this is infuriating me as I am by no means an Access expert , I'm just above beginner.
I am putting together a databse for our Credit Controllers to manage their arrangements to pay arrears.
The Main table consists of the fields.
CustNumber---Surname---Promise Amount---Actual Amount---Date
13456 Nakamura £25 £20 20/09/05
45323 Petrov £55 £55 13/09/05
21245 Hartson £23 £21 21/09/05
67543 Sutton £45 £26 25/09/05
23541 McGeady £50 £50 24/09/05
This table is input by a form.
What I want to do is to produce a Query which will total the Promise Amount column and The Actual Amount column using a Date Parameter.
For example I want to know how much has been brought in between 20/09/05 and 25/09/05 therefore producing the result that I'll get a total of £143 for the Promise Amount Column and £117 for the Actual Amount Column. I have tried using the "sum" in Totals, but I think the date parameter is affecting that, the date parameter query I'm using is :
Between [Enter the beginning date:] And [Enter the ending date:]
I'm using Access 2000. Can anyone help?
Thanks in advance
Steph
View 3 Replies
View Related
Dec 15, 2005
I am attempting to create a parameter query to show a specific range of dates of service for my customers. Example: I want to see data from my table from Jan. 1st, 2006 to Feb. 15th, 2006 for any customers serviced in that time frame. In the query I have under my Date field, I have the following in the criteria field: Between [Input Start Date] And [Input End Date]. When I go to the while in the design mode of creating the query on the main menu under Query then to parameters and get my Query Parameters what should be put into the Parameter column and the data type columns and will this allow the user to input any start date and end date and get the information from the master table?
I also need to create a parameter query that will allow viewing of only each months table data. Example: Jan. 1st, 2006 through Jan. 31st, 2006.
Thanks in advance!
View 2 Replies
View Related
Sep 21, 2006
I am trying to tell this query to get the wkending of the date (timeInDate). My query run but returns no data. Can anyone be kind enough to look at the red part?
SELECT tblOvertime.overtimeId, tblOvertime.peopleId, tblOvertime.timeIn, tblOvertime.timeInDate, tblOvertime.timeOut, tblOvertime.timeOutDate, tblOvertime.authorizedBy, tblOvertime.clientmatter, tblOvertime.dinnerMoneyTaken, tblOvertime.loggedBy, tblOvertime.comments, tblOvertime.lastUpdatedBy, [FirstName] & ", " & [Lastname] AS FullName
FROM tblOvertime INNER JOIN tblPeople ON tblOvertime.peopleId=tblPeople.PeopleId
WHERE ((((tblOvertime.peopleId)=Forms!frmOvertime!People Id Or (tblOvertime.peopleId)=Forms!frmOvertime!PeopleId Is Null)=True) And format((DateAdd("d",7-Weekday(timeInDate),timeInDate)),"mm/dd/yy")=Forms!frmOvertime!txtWkEnding Or format((DateAdd("d",7-Weekday(timeInDate),timeInDate)),"mm/dd/yy")=Forms!frmOvertime!txtWkEnding Is Null)=True
ORDER BY tblOvertime.timeIn, tblOvertime.timeInDate DESC;
View 2 Replies
View Related