Modules & VBA :: Count Number Of Unique Records Based On Range Of Date

Jan 19, 2015

Code:
' count records in query
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim beginDatum As String
Dim eindDatum As String
Set db = CurrentDb

[code]....

View Replies


ADVERTISEMENT

Modules & VBA :: Count Number Of Records With Date From A Table

Sep 24, 2014

I have a table which specifies the delivery date

I have a from that allows you to choose a year and a month.

I have an unbound textbox which I wan to display the count

I want to be able to count all the records from a table with the year and month specified in the comboboxes and display this in the texbox.

View 4 Replies View Related

Modules & VBA :: Create Multiple Records Based On Date Range - Button Click Event

Jul 31, 2014

I work for a company that manufactures home appliances & electronics. When those products fail within the warranty period, we are obligated to repair the units for the customers.

We have around 200 factory technicians who make those repairs. Each tech is able to make approximately 8 repairs each day. We have a dispatching system that assigns the repairs to the techs based on their availability each day. But the problem is that we have to manually enter and adjust the schedule for all 200 techs every single day, and this takes a lot of time. And of course technicians get sick, take vacation, etc, so we have to adjust the schedule so no techs will be assigned calls when they're off.

The problem: For example, currently when a technician takes off for 2 weeks, the user has to enter 14 individual records for the tech, which is somewhat time consuming. What I need is to program a button click event to determine the two dates (startDate & endDate) and append multiple records from one single entry in the form for each date in between and including the two date fields.

I know I'll probably need to create a loop that will loop through the two dates on the form and append a record for each day, so I can then cross reference the dates to the master schedule dates to make sure that no availability is opened for the techs taking time off.

View 3 Replies View Related

Use Vb To Create New Records Based On Number Range

Apr 16, 2014

I am looking for a way to use vb, or any other way, to allow my users to enter a railcar initial and then a number sequence and add new records to the end of the table.

For example in a form the user can enter the car initial and the number sequence
Railcar initial: GATX
Number sequence : 290001 - 290100

I would like a way to create a temp table that then has 100 records
GATX 290001
GATX 290002
GATX 290003
etc etc.

I can then use this temp table in an append query to add them to my main table.

View 7 Replies View Related

Queries :: Adding Sequence Number To Transactions Based On Date And Unique ID

Jul 29, 2014

I have a set of transactions with a Unique ID field and a date. I want to add a field based that gives me the sequence of events for each Unique ID in order of when it happened.

For example, if customer X has 6 transactions, the sequence field would have a number (1-6) in each record that corresponds to the order in which those transactions occurred. The first transaction would have the number 1, the second would have the number 2 and so on.

View 3 Replies View Related

Count Instances Of Records At Each Hourly Interval Within A Selected Date Range

Sep 30, 2014

I've got a single table with multiple fields, three of which are a date field ('DDate'), a time field ('TimeET') and a unique identifying field ('Unique Call Key').  I'm attempting to write a query in the QBE that will allow me to count the number of instances of 'UniqueCallKey' for each hourly time interval (7:00:00 AM - 7:59:59 AM, 8:00:00 AM - 8:59:59 AM, 9:00:00 - 9:59:59 AM, etc) for any selected date range (BETWEEN 'DDate'(1) AND 'DDate'(2)).  When I try to simply use the Count function on 'UniqueCallKey' as an Expression and 'TimeET' with 'Like '7:*AM' as a Where criteria then do the same with another instance of 'UniqueCallKey' and 'Like 8:*AM' as the criteria for a second Where criteria for 'TimeET' the query returns an empty set.  What I'm trying to accomplish would be a column of dates, a second column that counts the number of instances of 'UniqueCallKey' at the 7AM interval for each date in column 1, a third column that counts the number of instances of 'UniqueCallKey' at the 8AM interval for each date in column 1, etc to a final column for counts at 7PM.

View 3 Replies View Related

Modules & VBA :: Create Unique Reference Number Based On Field Values For Record

Jun 18, 2015

I want Access to automatically generate a reference number for a record based on the values in on two other fields for a given record using a form.

The first field is called Operation Number.

The second is Bag Number.

The reference number needs to be in this format: 19C.3.1

Where 19C is the Operation Number, 3 is the bag number, and 1 is automatically generated. Additionally I need the last number --the automatically generated one--to go back to 1 if with each new bag number.

This is kind of like library catalog numbers. Not sure how to do this.

View 2 Replies View Related

Create Multiple Records Based On Date Range

Jun 28, 2006

I have developed a Debt Management program for work but I am stuck on a feature that we need to add to it. Basically I have a table which holds "planned future transactions". These are ad hoc transactions that need to be added from time to time to the clients budget. For example the client might have $500 a quarter for school fees for the next two years or he might receive a bonus every six months for the next 5 years. Currently we are putting these in manually but it is tedious and is causing complaints. The feature I require is to be able to add a record such as the school fees, nominate that this fee is paid every three months for the next 8 quarters and get the system, say through an append query? to create 8 records, each with the appropriate date 3 months after the previous one.

Any suggestions or assistance would be appreciated.

Thankyou

View 1 Replies View Related

General :: Count Number Of Records Based On Certain Criteria Using DCount

Jun 5, 2014

I have a report that I am trying to complete based on several queries. I am trying to count the number of records based on certain criteria and using the following DCount.

=DCount("[Calculated time]","IPG1","[Calculated Time] <= 0.04" And [Ship-to party] In ("SN00207PJZ","SN09162XXX","SN09324XXX"))

I want to count the number of IPG1 records that are under .04 and have the Ship-to party of the ones listed. I have tried everything that I can think of to get it to work but can's seem to get it to. I figure it's something easy but I don't see it.

View 4 Replies View Related

Modules & VBA :: How To Count Number Of Events Based On Type

Dec 3, 2014

I have a table that contains many records of events. I've already created a multiple item form based on the table. My form contains 2 textboxes for input of a date range and a dropdown box to select "yes or no".

What I am having difficulty with is the query that will count the records by type insert it into the recordsource such that the multiple item form will appear like this:

Event Type| Count
Input | 4
Output | 2
Update | 3

How do I go about doing so? I have been testing with this simple query:

Code:
Private Sub Command8_Click()
Dim Task As String

Task = "SELECT EventType, Count(EventType) FROM Final GROUP BY EventType;"
Me.RecordSource = Task
End Sub

But the column that contains the count keeps appearing as #name?

View 12 Replies View Related

Modules & VBA :: Exporting Multiple Queries Based On Date Range

Aug 29, 2013

I have recently set up a button that exports multiple queries to one Excel file, using TransferSpreadsheet code. This works great and saves a lot of time, the only thing is on many of the queries I have a date range set, so you have to enter a date range to get the results.

Is there away that once I press the button I enter the date range once and than it exports the rest of the data based on this range, rather than entering the same dates multiple times.

View 1 Replies View Related

Modules & VBA :: Filter Subform In A Form Based On Date Range

Jul 26, 2015

So I have a search form that I created that has also a subform (a continous form, that has a query as its source) where my records are listed. I started on making a Between dates filter where i would be able to pick dates and get the results of records that are in that range.

I put two text boxes in which I set format to Short Date so that I get the button to select the date from a calendar for each text box. Then I made a button that is only for this and added a Clickon code so that it filters my subform over the recordsource of the form. The problem is is that i get an error and it doesn't filter.

Code:

Private Sub btnDatumUpis_Click()
Dim SQL As String
SQL = "SELECT qrySearchV.VID, qrySearchV.MarkVoz, qrySearchV.ModelVoz, " _
& "qrySearchV.TipMot, qrySearchV.Regist, qrySearchV.VlaVoz, " _
& "qrySearchV.KorVoz, qrySearchV.KatV, qrySearchV.DatumUVoz, " _

[Code] ....

View 5 Replies View Related

Modules & VBA :: How To Select Records By Date Range

Nov 30, 2014

I am trying to create a form that will select records by date range. The form contains 2 textboxes, with pop-up calendars to select dates. I managed to come up with this code, however, it's not working. Whenever I run the code, my database just goes blank, as though it's selecting something that is not in the records.

Code:
Private Sub Command16_Click()
Dim Task As String
Dim startDate As Date
Dim endDate As Date
startDate = Me.Text12
endDate = Me.Text14

Task = "SELECT * FROM Final WHERE Final.Timestamp BETWEEN #" & startDate & "# AND #" & endDate & "#;"
Me.RecordSource = Task
End Sub

How does one actually do the date range search? Could it be because my timestamp actually has both date and time, that's why the date search is not working?

View 5 Replies View Related

Count Unique Records

Sep 15, 2006

Hello, I am new to Access and trying to run a query that will count only unique invoice numbers in my table. I am sure this is an easy command, and thank you for your help!

View 3 Replies View Related

Count Unique Records

Sep 10, 2003

Hi there:

I have a Question

In Access 2002 (XP) I have to write a query that displays unique Id's:

For Example:

CustomerID Company Name
1 ABC INC
1 ABC INC
2 XYZ INC
2 XYZ INC
3 PQR INC

The query should be 3 records.

But for some reason when I write the query in sql view it doesnot work.

Thanks,
Ashi
http://www.ringvirginia.com

View 12 Replies View Related

Count Between Date Range

May 8, 2006

I am trying to run a query on a table [tblMain]. I have an input form where the user enters a date range. I would like to count the Month to Date Sales. The month would be that of the end date (forms!frmflash!enddate). How could I count the number of sales between the first of the month and the end date? Each record has a salesdate1, salesdate2, salesdate3, salesdate4, salesdate5, and salesdate6. I need to look in each of these fields and count the sale if it is between the 1st of the month and the enddate.

View 3 Replies View Related

Reports :: Count Unique Records Only

Sep 30, 2013

In a report, I have a textbox to show the number of employees in the report.

I use this formula : =Count([last name])

Sometimes the same person has multiple entries, so the count is wrong.

How can I show only the number of different employees and ignore the duplicate names?

View 3 Replies View Related

Value Based Upon Number Range

Apr 14, 2006

I am creating a query which determines the number of days a payment is delinquent. Is there a function I can use in a query field that would look at the numeric field and if the value of the subject field was:
< 60 Days "30-59 days"
< 90 Days "60-89 Days"
<120 Days "90-119 Days"
>=120 Days "120 Days +"

It was my understanding that the IIF function tests for a condition and can only return yes/no results. I seem to remember that SQL had something like a least or most function that would allow me to set maximum value for range of days. I apologize that my question is confusing and hope you can understand what I am trying to accomplish.
Thanks for any help

View 2 Replies View Related

Count Function To Return Unique Records

Sep 20, 2005

Not sure if I worded my subject correctly. Here's my problem.. I've used query to combine 2 tables of data..

Here are my fields..

I've assignment_num field, project_num field, project_name field, emplyee_name field.

here are my data..

assignment_num field: 1001, 1002, 1003, 1004, 1005
project_num field: 20,20,15,16,15
employee_name field: tom peter, tom peter, tom peter, julie, sally

What I want is to display the employee name with 2 projects or more...

What i have done?
I've done a group by and then count project_num field.. I also added a condition whereby the countofproject_num > 1.. everything went well except that the countofproject_num display 3 instead 2..

pls help.

View 13 Replies View Related

Change Count From Monthly To Date Range

Jul 31, 2007

The below code gives me a count based on a month and I would like to get the same count based on date range. I use a calendar control to provide the date range. See quote below: I am hoping someone can steer me int he right direction to convert the code from monthly count to a date range count.



Between [Forms]![OmsStatus]![StartDateTxt] And [Forms]![OmsStatus]![EndDateTxt]


SELECT DCount("[Date_of_Change]","all_trucks_table","[FORM #]=true AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)") AS FORMS,
DCount("[Date_of_Change]","all_trucks_table","[PQC #]=True AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)") AS PQC,
DCount("[Date_of_Change]","all_trucks_table","[ECN #]=True AND Month([Date_of_Change])=month(now) AND Year([Date_Of_change]) = year(now)") AS ECN,
DCount("[Date_of_Change]","all_trucks_table","[MCN #]=True AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)") AS MCN
FROM all_trucks_table
GROUP BY DCount("[Date_of_Change]","all_trucks_table","[FORM #]=true AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)"),
DCount("[Date_of_Change]","all_trucks_table","[PQC #]=True AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)"),
DCount("[Date_of_Change]","all_trucks_table","[ECN #]=True AND Month([Date_of_Change])=month(now) AND Year([Date_Of_change]) = year(now)"),
DCount("[Date_of_Change]","all_trucks_table","[MCN #]=True AND Month([Date_of_Change]) =month(now) AND Year([Date_Of_change]) = year(now)");

View 1 Replies View Related

Forms :: Count Weekday In Given Date Range

Mar 21, 2014

I am looking for Access VBA code to count number of Day Name in given range

E.g. March 01, 2014 to March 31, 2014
Mon = 5
Tue = 4
Wed = 4
Thu = 4
Fri = 4
Sat = 5
Sun = 5

View 11 Replies View Related

Queries :: Assigning A Number Based On A Range Of Dates?

Mar 19, 2013

I have a table called StockTable with the following fields Location, Status, Serial, Make, Model, LastDate, DotNumber

I also have a table called FCDateRange with three fields

DateStart DateEnd and DotNumber

For example

3/7/13 - 3/13/13 - 1
3/14/13 - 3/20/13 - 2

Im trying to figure how to write a query that if the lastdate from the StockTable falls during the DateStart and DateEnd fields it will assign it the number in the DotNumber field

View 2 Replies View Related

Modules & VBA :: Count Of A Variable Range

Jul 30, 2015

1. I have a sample database table in excel where depending on column 2 value >1 is checked and logical results by IF check placed in Column D. The values having "Y" in column D are placed in Columns E:F.

2. Now I want to place count of values meeting the condition on last cell of the filled E:F range.

3. VBA code written by me proceeds fine and places values meeting condition in column E:F

4. I am beginner to VBA and finding difficulty in proper code for placing sum of counts of acceptable values in range F2:F7 in cell F8 ie last value in the array. Presently I have placed the value by In-built Count function in Excel.

File Count on Macro from another table is attached.

View 1 Replies View Related

Print Date Range On A Report Based On A Non-date Field

Aug 7, 2005

Is there a way to show the earliest and latest dates of a report generated by a non-date field?

E.g. I generate a report based on Food, and it'll list the days that this food is associated with. Is there a way to show the first and last day that appears in this report (i.e. the range of dates that the report shows based on the food selected)

View 2 Replies View Related

Modules & VBA :: Total Count Of Unique Values In A Query

Jan 13, 2015

I have the following code:

Code:
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT DISTINCT tbl_contract_lev.ContractID FROM (tbl_leverancier_gegevens INNER JOIN

[Code] ....

The result of the query is a list fo unique values but by including the "count" function in SQL seems not te be working in combination with "DISTINCT"...

View 5 Replies View Related

Queries :: Date / Time Query - Return All Records Of Specified Date Or Date Range

Aug 19, 2015

I have a table that has entries recorded with date and time in one field, and I want to have a query that returns all records of a specified date or date range, regardless of the time in the field.

I have tried

Code:
Between [StartDate:] And [EndDate:]

And

Code:
Between [StartDate:] & "00:00" And [EndDate:] & "23:59"

Neither of which work ....

View 13 Replies View Related







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