Query Help - Filtering For A Date...

May 17, 2007

This query is to show aging. I have a field for processed date. I have a query that allows a date range to be selected using the Between function.

The query runs and pulls these variables from a form. It shows only those accounts which were processed between those dates.

However, it is also showing all of the accounts that have no date in this field. I need to set it up so that if the field has no date then it doesn't show those accounts.

I've tried Not (is null) for the criteria but that isn't working. I've tried a lot of stuff but nothing seems to work.

Thanks for the help :)

View Replies


ADVERTISEMENT

Queries :: MS Access Cross Tab Query - Date Range Filtering

Aug 14, 2013

I just wanted to know how can i set a parameter on the following cross tab query to filter dates. Date field is [pdate By Day].

TRANSFORM Sum([PettyMaster Query2].Amount) AS SumOfAmount
SELECT [PettyMaster Query2].[Petty Cat].Field2, [PettyMaster Query2].[pdate By Day], [PettyMaster Query2].ProjLoc, [PettyMaster Query2].descriptionofpay, [PettyMaster Query2].projno
FROM PettyMaster, [PettyMaster Query2]
GROUP BY [PettyMaster Query2].[Petty Cat].Field2, [PettyMaster Query2].[pdate By Day], [PettyMaster Query2].ProjLoc, [PettyMaster Query2].descriptionofpay, [PettyMaster Query2].projno
PIVOT [PettyMaster Query2].PettyCOA.Field2;

View 11 Replies View Related

Problems Filtering By Date

Aug 11, 2005

i have created a new form based on a database called RptSmp97 from microsoft knowledge DB.
My form, as in the sample, calls a report when it is opened and at the same time shows you a multicombo form for filtering the report. In the sample the form uses only text fields, but i need to use numeric and date fields too. I could solve the problem with the numeric combos adding a condition for them, however, when i add another condition for the date it doesnt work.
Also, at the end of the code i print the sql and it looks perfect.

here is the code when the apply filter button is pressed....

Private Sub Command18_Click()
Dim strSQL As String
Dim intCounter As Integer

'Build SQL String
For intCounter = 1 To 15
If Me("Filter" & intCounter) <> "" Then
MsgBox Me("Filter" & intCounter).Tag
If Me("Filter" & intCounter).Tag = "effective_dt" Or Me("Filter" &
intCounter).Tag = "issue_eff" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & "
>= (" & Me("Filter" & intCounter) & ") And "
End If
If Me("Filter" & intCounter).Tag = "change_id" Or Me("Filter" & intCounter).Tag = "priority" Or Me("Filter" & intCounter).Tag = "Dom" Or Me("Filter" & intCounter).Tag = "Intl" Or Me("Filter" & intCounter).Tag = "Tasman" Or Me("Filter" & intCounter).Tag = "Regional" Or Me("Filter" & intCounter).Tag = "AA" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Me("Filter" & intCounter) & " And "
End If
If Me("Filter" & intCounter).Tag = "name" Or Me("Filter" & intCounter).Tag = "status" Or Me("Filter" & intCounter).Tag = "assignee" Or Me("Filter" & intCounter).Tag = "app_status" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
End If
End If
Next

If strSQL <> "" Then
'Strip Last " And "
strSQL = Left(strSQL, (Len(strSQL) - 5))
'Set the Filter property
MsgBox strSQL
Reports![RepFilter].Filter = strSQL
Reports![RepFilter].FilterOn = True
End If

End Sub

thank you in advance, max.

View 6 Replies View Related

Filtering Date Input

Dec 1, 2005

i am trying to build a marine turbine and parts log and have a problem in satisfying a working rule.

i have 2 tables which i have attached,

table 1 shows the on / off dates that a generator was fitted to a turbine

table 2 shows a general date history of the generator, when it had checks done, fitted, etc

what i would like to do is fit the generator again to another turbine

using a continous form to show the available dates in table 2, i would NOT like to see the dates during the period when the generator was fitted previously as shown in the on / off the dates in table 1.

the working rule being that a generator can not be fitted to 2 different turbines at the same time

can anybody point me in the right direction or assist in how i can overcome this problem

many thanks in advance for help provided

View 3 Replies View Related

Filtering By Date In A Report?

Oct 28, 2013

I've created a Form where I enter all my data - then I created a Report to output this data, it includes two buttons to filter based on one category. That's working fantastically well for me.

But now I would like to filter on dates. For example, last 7 days, last 14 days etc - and also give the user the option of filtering between x and y dates. I've discovered this is easily done by right-clicking the date field in the report, but I'd prefer to embed these commands into buttons etc so it's easier to navigate.

View 2 Replies View Related

Filtering Specific Date Periods

Oct 29, 2006

Hi all!

I want to add a function to a form that filters records from a specific date period.

Each record has a field containing the date the record was added.
Example: I want to show the records added between 15.09.2006 and 10.10.2006.

Furthermore, the “from” and “to date” must be defined in textboxes, and the filter initiated with a button.

I need this functionality on a continuous form and in a report. How do I achieve this?

View 14 Replies View Related

Modules & VBA :: Date Filtering Through Excel

Jan 27, 2014

I have an Excel workbook which I use to extract data from an Access database using VBA. A requirement has popped up to show things from the last week. Unfortunately, I can't just use a Date()-7 query in Access as the start point might be different, so it needs to be based on seven days prior to a date field in Excel.

So, I have a cell in Excel with a date, in this case "16/01/2014". I want to then use that date in my query to say "greater than 8 days prior to to this date". The field is formatted as a date and the variable (DatafileDate) taken from this field and passed to the function is a Date. In my Select query I then have this line to select the top 5 marked as UK accounts in this case:

Code:
SearchText = "SELECT TOP 5 * FROM `" & TableName & "` WHERE `" & TableName & "`.`Account`='UK' AND `" AND `" & TableName & "`.`Close Date` > #" & DatafileDate & "#"

Code:
#" & DatafileDate & "#" -8

Should mention that the TableName stuff is so the name of the table can be set elsewhere. "Close Date" is the column in my Access query I need to filter on.

View 2 Replies View Related

Filtering For Lowest Date Out Of Duplicate Records

Mar 13, 2008

I have a table that has a list of order information, there are multipule records per order that have information about when the order was processed. There is a day tied to the process time of each record, I need to filter out the duplicate records and get one record for an order, but that one record must be the first process time entry for that order. Anyone know how to make this query? Let me know if this doesnt make sense.

View 4 Replies View Related

Queries :: Filtering On Value Of Formatted Date Field

Feb 22, 2014

I have a database with a table of employees, and that has a column named "DaysOff", into which I type a couple of days like this: "SUNDAY AND MONDAY"

Next, I have a form onto which I will display a query of those employees. The form contains a field called DATE in which I display the mm/dd/yyyy date. What I want to do is this:

I only want those employees that have a DaysOff field that DOES NOT CONTAIN the WEEKDAY NAME of the date in the DATE field. So, for instance, if the DATE field read 2/22/2014, and I have three employees as such:

Employee 1 DaysOff "Monday and Tuesday"
Employee 2 DaysOff "Friday and Saturday"
Employee 3 DaysOff "Sunday and Monday"

In that case, ONLY EMPLOYEES 1 and 3 should show up. Employee 2 will NOT show up, because his DaysOff field contains the word "Saturday", and the WEEKDAY FORMATTED value of the DATE field is "Saturday"

I hope that's not too confusing. Again, this needs to be the filter criteria for the query. That query will only return a list of employees that are NOT off on the day in question. If one of their off days is the day in question, the query won't return that record.

I've tried a few things, but I can't get it to work. If you want, I can list the various things I've tried, but I imagine one of you knows exactly how to do what I need to do, and you won't need my feeble attempts as a springboard.

View 2 Replies View Related

Filtering Data With Date And Check Boxes

Aug 25, 2014

I am new in MS Access programming and is trying to create a search form for all records based on selected dates and check box. I was able to filter the records by dates but can't find ways to filter the records that meet the dates to be filtered again based on the selected check box/s. Basically what I wanted to is display all the records within the selected dates and check box/s.

View 9 Replies View Related

Reports :: Report Not Filtering Correctly With Date Inputs?

Mar 13, 2013

My report generates base on 2 date inputs(from textboxes) namely, ProcStartDate & ProcEndDate & a combobox(cmbRptSupplier) to select the supplier:

Code:
Private Sub btnReport_Click()
Dim strDocName, strWHERECondition As String
strWHERECondition = ""
If Me.cmbRptSupplier = "" Or IsNull(Me.cmbRptSupplier) = True Then

[Code].....

When I leave my cmbRptSupplier blank (so that I can leave supplier out of my criteria), & fill in 1/2/2013 for ProcStartDate, 14/3/2013 for ProcEndDate, I get ALL the invoices displayed in return for my report. Even with those before 1/2/2013.

View 10 Replies View Related

General :: Date Format In Table - Filtering Data

Jan 19, 2014

I have a table having column as date, format as mm/dd/yyyy and i update the column as now() using VBA.

However some places the date is in mm/dd/yyyy and in some mm/dd/yyyy nn:mm:ss are appearing which is making the filtering of the data ambiuge.

View 2 Replies View Related

Queries :: Access 2013 - Filtering Report By Date?

Jan 14, 2014

Access version: 2013 / The user can click a button on the report that opens a form where they can select various filters. Once the user has selected the filters and clicks done, I have some VB code that fires which builds an SQL string with all of the filters selected. It then reopens the report with the new filter.

What I am running into issues with is one specific filter that the user can select. They can select a "from date" and "to date". Sometimes this filter returns what I want and sometimes it doesn't.

For example. I set 01/01/14 as the start date and end date as 15/01/14. <-- this works as desired.But if I put start date as 10/12/13 and end date 15/01/14 for example then it returns all previous records up to the specified end date. I.E dates such as 10/10/13 will show.

This is the VB code used to build the SQL for this filter:

Code:

newWhere = newWhere & "[FollowUpDate] > #" & Me.txtFromDateSelect & "# AND [FollowUpDate] < #" & Me.txtToDateSelect & "#" & " AND "

note: I have also tried using the between SQL syntax for querying the date to no avail and the same results.

This is the SQL that the above code creates:

Code:

[FollowUpDate] > #1/01/2014# AND [FollowUpDate] < #15/01/2014#

This only happens when I try select a start date prior to 12/12/13 (so the year is not the issue)

This happens both when I apply just the from date and to date filter and also when I mix it in with other filters. I.E Company name, product etc..

View 6 Replies View Related

Modules & VBA :: Filtering Subform (datasheet) By Fields (Date)

Mar 27, 2014

I filter my subform (datasheet) by fields, everything works great except "date" column. MS Access shows that record does not exist but it isn't true.

Code:
Me![frmAktPD].Form.Filter = "[Data przyjęcia] = " & Me.DataPrzyjecia
Me![frmAktPD].Form.FilterOn = True

Where is the problem?

View 1 Replies View Related

Forms :: Filtering List Box Using A Date Rage And Combo Selection

Jan 5, 2014

I am using this code to filter a List Box based on a Date range and a Combo Box selection:

Code:
Private Sub Combo139_AfterUpdate()
Dim StrgSQL As String
StrgSQL = "SELECT [User Name], [Date Of Request], [Description of Problem], Status, Sub_Job FROM QRY_SearchAll " & _
"WHERE [Date of request] BETWEEN #" & CDate(Me.txtStartDate) & _
"# AND #" & CDate(Me.txtEndDate) & "#;"
StrgSQL = StrgSQL & " WHERE Sub_Job = Combo139"
Me.SearchResults.RowSource = StrgSQL
Me.SearchResults.Requery
End Sub

However, It is not working. when I click the Combo box the List Box comes up blank.

View 13 Replies View Related

Modules & VBA :: Filtering Subform By Mainform Date Text Boxes?

Jul 25, 2013

I'm having issues with this one.

Table name is CompDates
Subform is ViewByMarket

Start date is Text13 and End Date is Text15.

I want it to filter out any matches between the 7 fields. Here is my code:

Code:
Private Sub Command19_Click()
Dim strFilter As Variant, _
strSDate As String, _
strEDate As String
'check Text13
Text13.SetFocus 'set focus to Text13 to be checked

[code].....

It will only filter for Build Date 1 and not for any of the other fields.

View 1 Replies View Related

Filtering A Query...

Jan 4, 2006

i have about 14 fields that relate to subjects, basically i want to be able to run a query that searches for all the people who have choosen the module and report bak who they are..

now i know i can do this 14 times over but is there a way that the user can choose the subject first and the query will then run hence meaning only one query/report.. i thought of using a list/combo box but have absolutely no idea...

im very much a novice but any help would be most apreciated!

cheers

si

View 2 Replies View Related

Query Filtering

Feb 27, 2007

I have a query filtering question. Please note attach pic for further details. I am trying to put together a search in a form to seach for a certain color or color series from a Qery from two two different sources (from a Combo Box and from a Text Box). I am not sure how to set this up in the query.

Can someone please point me in the right direction?

Thanks,

Kilch

View 2 Replies View Related

Filtering A Query

Jan 11, 2008

OK, new problem to solve. I don't know if I am going about this the right way, so please feel free to make suggestions on better ways to acheive an outcome!

I have a query "qryBuildsPrinted" which searches a specific table for appropriate records, feeds these selected records into a report "rptBuildSlips" and prints them.

I am now trying to allow the user to print these build slips selectively, instead of printing out the whole lot pulled in by the query every time. My approach is to use the existing query, but filter the query based upon some selections made by the user in one of my forms. I am having trouble getting the query to filter successfully.

I realise that you can filter both the query and the report independently, so I probably only need to filter the report, but that is not working for me either!

Here is my code:

Private Sub cmdPrint_Build_Slip_Click()
Dim intBikeID As Integer, intBuildID As Integer
Dim varItm As Variant
Dim ctl As Control
Dim intCounter As Integer
Dim intRecords As Integer
Dim varArray() As Long
Dim strFilter As String
Dim blnPrinted As Boolean
Dim msgMessage As Variant

'Print Build Slip for selected bike

'Set Control
Set ctl = Me.lstResults
intRecords = 0
intCounter = 0

'check if a selection has been made (kinda dodgy)
For Each varItm In ctl.ItemsSelected
GoTo Selection_Made
Next

GoTo CleanUp

Selection_Made:
'Count how many records have been selected
For Each varItm In ctl.ItemsSelected
intRecords = intRecords + 1
Next

'Clear Array and Re-allocate Upper Bound of array (Array starts at 0)
ReDim varArray(intRecords - 1)

For Each varItm In ctl.ItemsSelected

'determine BuildID of selected record
intBikeID = ctl.ItemData(varItm)
intBuildID = DLookup("[BuildID]", "tblBuilds", "[BikeID] = " & intBikeID)
blnPrinted = DLookup("[PrintedSlip]", "tblBuilds", "[BikeID] = " & intBikeID)
If (blnPrinted = True) Then
msgMessage = MsgBox("One of the bikes selected has already had a Build Slip printed. Please adjust your selection", vbOKOnly, "Build Slip Already Printed")
GoTo CleanUp
End If

'Fill array with values, given how many values are present
varArray(intCounter) = intBuildID

'Adjust counter to go to next array value
intCounter = intCounter + 1

Next

'Select Filter String
Select Case intRecords
Case 1
strFilter = "[BuildID] = " & varArray(0)
Case 2
strFilter = "[BuildID] = " & varArray(0) & " Or " & varArray(1)
End Select


'Open query which displays the bike selected
DoCmd.OpenQuery ("qryBuildsPrinted")
'DoCmd.ApplyFilter , strFilter

'Print report of query with filter applied
DoCmd.OpenReport "rptBuildSlips", , , strFilter

'Close query, remove filter
DoCmd.SetWarnings False
DoCmd.Close acQuery, "qryBuildsPrinted"
DoCmd.SetWarnings True

ctl.Requery

GoTo CleanUp

CleanUp:
intBikeID = Empty
intBuildID = Empty
Set varItm = Nothing
ctl.Value = Empty
Set ctl = Nothing
intCounter = Empty
intRecords = Empty
strFilter = Empty
blnPrinted = False


End Sub

A further question that is probably on the same topic is that once this has been completed, I also need to modify my existing Update Query which makes a modification to the data in the table. Is it possible to apply a filter to an Update query also?

I realise this may not be the most effective use of Access, so as I said, please feel free to suggest alternate methods I can research.

Regards,
Jon

View 3 Replies View Related

Query Filtering From Form

May 17, 2006

I have a query that when run asks for a client ID and then displays a total of funds for that client.

I also have a form for each client's persobal details and I would like to have a command button on that form, that when clicked runs the query automatically using the client ID being used.

I can get a command button to open another form based on client ID but not a query.

many thanks

View 2 Replies View Related

Help Filtering Duplicate Records From Query

Nov 28, 2007

Dear Experts,
I have created a database with queries that is working fine, however there are many records that have the same information that can not be removed easily, is there a method anyone knows of that can filter the records produced from a query to remove duplicates? i.e. 'select distinct' but for the whole query after the search parameters have been entered.

e.g. the search query is producing, after the refined search values are entered:
414353p - Fiat - 1.6 - MLS
414353p - Fiat - 1.6 - MLS
How can i then apply a filter to automatically reduce these duplicates to just one entry for the whole form?

Thanks

View 6 Replies View Related

Filtering Query For Combobox In Subform

Jun 21, 2005

I have this form where there's mention of CompanyID

In a subform, I have the information about all the contacts of this Company. In order to see full detail information for a particular contact (of that particular Company) I have a Combobox with a query.

At least: that's the whole idea. Unfortunately it doesn't work in Access:
SELECT Contact.ContactID, Contact.Name
FROM Contact
WHERE ((Contact.CompanyID)=(Me!frmCompany![ContactID]));

Can any help me? I need to do more of the sorts of queries... and I can't figure it out how to use values from forms and parent-forms.

Any help is appreciated,

Jazz

View 1 Replies View Related

Problem Filtering Records From Query

Jan 19, 2007

I have a database with 2 tables. Table1:drawing number and drawing title and Table2: date, action, status. Table2 gives the complete history of our internal review process.

Example:
Number=001, Title=Drawing001
date=01/01/07, action=drawing received, status=
date=02/01/07, action=drawing checked, status=approved
date=03/01/07, action=approval sheet issued.

Number=002, Title=Drawing002
date=04/01/07, action=drawing received, status=
date=05/01/07, action=drawing checked, status=not approved
date=06/01/07, action=approval sheet issued.

I need a report which lists just the 'not approved' drawings. I've been able to add a query which lists the drawings but I loose the complete history, i.e. drawing recieved date.

Is there anyway I can display all the fields but only for those drawings which are 'not approved'

View 4 Replies View Related

Query Help - Filtering Duplicates Within A Group

Feb 24, 2007

hi there,

Im trying to develop a query which will show me players with the same 'player number' in a team.

I have two tables; players and teams.

Each player in a team should have a unique player number, so I want it to show records if eg Jim and Bob are both in Team X and they are both number 6.

Any tips would be great -

View 1 Replies View Related

Problem With Filtering In Query Table

Nov 17, 2007

I've been generating a report using two forms for data, and everything has worked well until recently.
My report contains a field which tracks Therapist visits by date. Since the subform now contains multiple dates for each patient, the report prints a line for each date, resulting in two or three lines for each patient.
I would like the report to print a single line for each paient with the most recent date only. I've tried a fix suggested by another user in the Forum...(Top Value) in the query, but this resulted in only a single record being printed for the entire database. I then tried to add MAX(date) to the CRITERIA line for the DATE field, but now I get the message
"Cannot have aggregate function in WHERE clause". I'm stumped at this point, so any help would be greatly appreciated.

Doug

View 14 Replies View Related

Forms :: Filtering A Query Using A Form

Feb 9, 2014

I currently have this form (combobox) that filters using one piece of criteria.

Private Sub cboSelectPress_AfterUpdate()
'Moves to Press field and
'finds records where "press" matches whatever is selected in the combo box
DoCmd.ShowAllRecords
Me!Press.SetFocus
DoCmd.FindRecord Me!cboSelectPress

End Sub

"Press" is a machine number. How can I add more combo boxes to filter additional information from my query. Like "room" or "product" or "date?" What happens if the user leaves one of the boxes blank?

My fields are

"Date"- date the product was ran
"press"- the press it was ran on
"product"- the name of the product
"shift"- the shift it was ran on

I want the user to be able to select ALL or none of these fields for results.

I am using Access 2013

View 2 Replies View Related







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