Queries :: Calls Table - Finding Last Contact Date

Aug 7, 2014

There are three tables. An [Action Register] table, a [Calls] table and a [tblContacts] table. The Contacts are common to both.

The Calls table records calls to customer by date

The Action Register table records issues that Customers send in by Open date.

I am trying to make a query where we see the latest date the customer was contacted regardless of which table.

I created two queries.

qryLastCallDate finds the max date from the Call table:

SELECT Max(Calls.CallDate) AS MaxOfCallDate, tblContacts.ContactName
FROM Calls LEFT JOIN tblContacts ON Calls.ContactID = tblContacts.ContactID
GROUP BY tblContacts.ContactName
ORDER BY Max(Calls.CallDate);

qryLastIssueDate finds the max date from the Action Register table:

SELECT Max([Action Register].Open) AS MaxOfOpen, tblContacts.ContactName
FROM tblContacts RIGHT JOIN [Action Register] ON tblContacts.ContactID = [Action Register].Contact
GROUP BY tblContacts.ContactName
ORDER BY Max([Action Register].Open);

The problem I am having is that if I use Left Join I can see all the records from the Calls table but not all from the Action Register table. And vis versa if I use Right Join. This is because sometimes we have calls but no issues in the Action Register table and sometimes issues with no calls.

This is my Left Join query using a Min Max Module I found here: [URL] ....

SELECT qryLastCallDate.ContactName, qryLastCallDate.MaxOfCallDate, qryLastIssueDate.MaxOfOpen, qryLastIssueDate.ContactName, DateValue(MaxOfList([MaxOfCallDate],[MaxOfOpen])) AS [Last Contact], ([Last Contact]+21) AS NextCall
FROM qryLastCallDate LEFT JOIN qryLastIssueDate ON qryLastCallDate.ContactName = qryLastIssueDate.ContactName;

How do I get to see ALL the records from both queries.

View Replies


ADVERTISEMENT

Search Forms - Finding A Contact And Displaying All Related Info

Nov 22, 2005

Hi

I am pulling my hair out with what I am sure is a simple task, creating a search form that, when criteria are entered, finds a record and displays related data/results from 3 tables. I have tried every forum and web post I can find but I think there must be something fundamental I'm neglecting to grasp.

Quick background:
My database has 4 tables, Firm, Contacts, Mailout and FileNote
The database is contact-centric (ie, everything is linked to a contact record, multiple contacts are held against firms, mutiple file notes are held against a contact, contacts can be attached to multiple mailouts)
I need to search for a contact record based on multiple criteria (keeping it simple, lets say a combination of first_name & last_name OR first-name & firm_name OR their specific contact ID)
I need a 'results form' (not just a datasheet view) that displays all information related to that contact (i.e. all files notes + ability to create new ones, firm contact information, and mailout history)


I've created a Main form with Firm, Mailout, Contact & Filenote subforms embedded that enables me to scroll through every contact and view all related detail (as above) and add file notes & modify data very nicely. My problem is I can't search, I can only move through each record sequentially. Very handy when we have 4000 contacts!

I realise I'm probably a complete wally but could someone please explain to me the vital steps I'm missing? I've tried unbound fields, I've built SQL queries & command buttons (but results are dumped into a datasheet)....I'm lost.

Many many thanks.

View 2 Replies View Related

Queries :: Number Of Calls During Business Hours

Oct 28, 2014

I have to create a query that will reflect the number of calls and messages a person has either taken during business hours and if a message was left how long did it take them to return the message. We are open from 6:00AM - 4:30PM so my boss wants to only see how many calls a person took during business hours. now the users have to run this report daily and monthly. and have to make it accessible through a report so they can send it to the supervisors.

The two fields I have to make the calculations on is the [Date & Time Left] the time the call was made [Date Returned] if they left a message the date it was returned. Also if the call was returned in one day she wants it broken down into minutes (as in how many hours and mins was the call returned)

This is what I have so far: I noticed there was something in Excel called NETWORKDAYS?

Code:
SELECT [Message Tracking].[Date & Time Left], [Message Tracking].[Date Returned], DateDiff("h",[Date & Time Left],[Date Returned]) AS TotalHours, [Message Tracking].ID, [Message Tracking].[User Returning]
FROM [Message Tracking]
GROUP BY [Message Tracking].[Date & Time Left], [Message Tracking].[Date Returned], [Message Tracking].ID, [Message Tracking].[User Returning]

View 1 Replies View Related

Queries :: Finding Records In A Query Where Date / Time Has Been Used?

Aug 15, 2013

I have a database that is used (partially) to enter appointments during a day. In the appointment column I've entered the date and time as dd-mmm-yyy-hh-nn-ss. I'm now trying to search for appointments entered on a specific day through a user input ([Enter Date] in the query criteria) Problem is, this only returns records where the time hasn't been entered and the time shows as 00:00:00.

I've tried CDate which gives me add/mmm/yyy return. if I try to search against that I get nil returns though. As a test I put DATE() in the criteria but it then says that it's an invalid foremat. I've also tried various machinations of "Like" and "Between" without success.

View 5 Replies View Related

Queries :: Finding Previous Record Date Difference?

Dec 17, 2013

I am trying to use a query to find the previous record of a transaction and provide an additional field that computes the difference in the dates in days. (The days from TransferID 23 to TransferID 24)

TransferID Job Number Tool Number TranferDate DaysOnRent
22 1 10 9/1/13
22 1 12 9/1/13
23 2 10 10/18/13
23 2 12 10/18/13
24 3 10 12/15/13
24 3 12 12/15/13

I have seen other posts that reference the following link.

[URL]

View 8 Replies View Related

Queries :: Booking System - Finding Available Room For Date Range?

Feb 18, 2014

So I'm trying to do this database for my ICT coursework and its a full system for dog kennels.

So in actuality the rooms are kennels.

I have a table tblbookings that amongst others has fields:

Kennel No
Date In
Date Out

I need a way of users entering the requested dates for a new booking and getting an output of a list of all kennels that are available to book for that full date range or even better, a way of running this straight from the form for a new booking frmbookings to just leave the first available kennel no. in the field KennelNo?

View 5 Replies View Related

Queries :: Finding Names That Appear More Than Once In A Table?

Jul 29, 2013

I have a table with associate names and rankings for each month. I need some way to find out which associates appear in 2 consecutive months with a certain rating. I have a query that will allow you to key in which month you want to look at, but I can't figure out how to write the query to return results only for those associates that appear twice in the months chosen. For example:

John Doe was rated 1.5 in May and 3 in June.
Jane Doe was rated a 1.5 in May and 1.5 in June.

I want a query that will allow me to put in May and June as the criteria as well as < 2 for the rating and only return those that show in both months...

View 5 Replies View Related

Queries :: Finding Distinct Records In Table A That Are In Table B

Dec 19, 2013

tbl_A has column "ID" with duplicates. tbl_B has column "ID" with distinct values.i want to find all the distinct IDs in tbl_A that are present in tbl_B.I've tried the following with no luck:

SELECT DISTINCT tbl_A.ID
FROM tbl_A LEFT JOIN tbl_B ON tbl_A.ID = tbl_B.ID
WHERE tbl_A.ID IN tbl_B.ID;

View 3 Replies View Related

Contact Databse With Date And Time Fields

Apr 13, 2005

I created a Contact database where I have the date and time as two separate fields in one of the tables. I have them defined as such, but would prefer that the fields wait until I enter data into them and not auto fill with the current information. Is there a property of these fields I can set so that these fields do not get auto filled? Again this database is too large to send, so I hope that you can help without it.

View 1 Replies View Related

Queries :: Dlookup Value From 1 Table With Date Ranges From Diff Table With A Single Date?

Mar 12, 2015

i have 2 tables.. 1 with bookings and 1 with a BonusPeriod range.

in the Bookings table there is a field called [ServiceDate]

in the bonus table i have a field called [Period] which is text i also have 2 dates, [StartDate] And [EndDate] i need to Dlookup the Bonus table to return the value of the period table based on where the [ServiceDate] falls.

i dont want to use VBA (i really need it to work within a query that inserts it's data into another table)

i've tried everything but had no joy

Expr1: DLookUp("[Period]","BonusPeriods","[ServiceDate]" Between "#[StartDate]#" And "#[EndDate]#")

Expr1: DLookUp("[Period]","BonusPeriods","[Staff_BookingsAndQuotes_Master].[ServiceDate]" Between "#[StartDate]#" And "#[EndDate]#")

Expr1: DLookUp("[Period]","BonusPeriods","(FormatDateTime([ServiceDate]),"yyyy-mm-dd") Between (FormatDateTime([BonusPeriods]![StartDate]),"yyyy-mm-dd") and (FormatDateTime([BonusPeriods]![EndDate],"yyyy-mm-dd"))))

View 10 Replies View Related

Queries :: Crosstab Query That Keeps Each Contract On One Line And Separate Fields For Each Contact

Jun 4, 2014

I have two tables, and I'm trying to create a crosstab query...I think. One table is Contracts, one is Contacts. Each contract could have multiple contacts, but they are numbered (1, 2, 3...etc.) based on importance. I want to create a query that keeps each contract on one line, and separate fields for each contact and each field of the contact. So a contact will have Title, First, Last, Address, etc. So I want my query to show as follows:

Code:
Contract-----Title1-----First1-----Title2-----First2
ContractX Mr. James Mrs. Sally

I of course need this to be dynamic, so if a contract has 9 contacts, there are fields up to Title9, First9, etc.

View 7 Replies View Related

Contact Table - Filter Set For Field Not Saving

Dec 17, 2011

I Have a Contacts table, when I use the filter on the field that I want filtered I get what I want, no problem, however when I save that filter and close the table and then reopen it it the filter is gone, how can I save the filter that I set up?

View 2 Replies View Related

Pulling Contacts From Two Tables Into Third Contact Table

Apr 29, 2014

Ok, I have 3 tables. One lists a contact in conjunction with the branch of the company and the trips that contact takes. The second lists a contact in conjunction with the branch of the company and which team they work with (may work with many). The third should list their email address and their phone number. Is it possible to pull the contact name and branch of company from tables 1 and 2 into 3 automatically, such that all I have to input into table 3 is additional contact information? If that is possible, is it also possible to only pull each contact/branch of company pairing once (I don't want four entries for Joe Shmoe/Sales, even if he's taken 4 trips)?

Table 1
Branch of Company
Trip Dates
Trip Location
Contact

Sales
4/1/14-4/12/14
Chicago
Joe Shmoe

HR
6/2/13-6/4/13
New York
Jane Doe

Table 2
Branch of Company
Company Team
Contact

Sales
Blue Devils
John Deere

Sales
Jets
John Deere

Sales
Jets
Joe Shmoe

HR
Sharks
Jane Doe

Table 3Contact
Branch of Company
Email
Phone

Jane Doe
HR
jane.doe@company.com
800-555-1234

Joe Shmoe
Sales
joe.shmoe@company.com
800-555-1235

John Deere
Sales
john.deere@company.com
800-555-1236

View 4 Replies View Related

Queries :: Find Date In Table 1 Closest To Another Date In Table 2?

Mar 17, 2015

I have a table, tblVisits, holding patient's pre and post surgery visits:

Code:

PatientID VisitDate
1 1/5/12
1 3/10/12
1 9/1/13
2 ...

And another table holding patient's surgeries (each patient will have only one surgery)

Code:
PatientID SurgeryDate
1 4/1/12
2 ...

I need to compare these two tables and create a variable that indicates which pre-surgery visit date (i.e., VisitDate < SurgeryDate) is closest to the surgery date. In the above example, it would return:

Code:
PatientID VisitDate ClosestToSurgery
1 1/5/12
1 3/10/12 Yes
1 9/1/13
2 ...

I've tried various MIN and MAX approaches and can't seem to get it right.

View 2 Replies View Related

Finding Max Date

Jul 21, 2006

ok ihopefully i wont make this too complicated to under stand.

i ahev a form which will populate a form from a query. the query is pulling info out a table included int hti sinfo is the date when it was entered. in the criterai of the query i hve added this code
Between [Forms]![Boxes Reviewed]![txtFromDate1] And [Forms]![Boxes Reviewed]![txtToDate1]
whcih means that the date must be between the two differnt dates that must be entered on the form.

the problem is, is that a value can be entered more that once with different dates. i woul dwant the report just to shouw the most recent date. i considered doing a query which requested all max dates from the table and then having a query calling forma query. but i do not know enough on how to get just the most recent date.
so if i wrote a query which held

box num, shelf num, resp_person, and date. what would i have to put int he criteria to only bring back the entery witht he most recent date.

sorry if i have rambled and look forward to your help

View 1 Replies View Related

Finding The Date Of An Enquiry

Jan 8, 2007

Hi There,

I am an Access novice and have managed to create a DB to record all incoming enquiries to my business. The enquiries are entered via a form onto a table and one of the fields is the date of the enquiry, which is entered as 01-Jan-07.
What I want to do is build a query that will find all enquiries in a given month.
Has anyone got a simple soultion, please?

Best regards
Keith:(

View 5 Replies View Related

Finding 'before' On A Date Of Birth

Feb 4, 2008

If I have a Date Of Birth in the form XX/XX/XXXX, what code do i need to use in the Design View CRITERIA Box. Thanks for all your help!

Richard J

View 1 Replies View Related

Forms :: Add A Command That Changes Contact Status In Archived Field Of Table

Jun 18, 2013

I have a query that gets it's data from tblContacts. In this table is a yes/no field for archiving and the query gets only those records with a No in the field. The default is no. Next I have a form based on this query, which I am using to hold a set of command buttons which act on a contact chosen from an unbound list. So far so good but now I would like to add a command that changes the contact's status in the archived field of the table to Yes, so that I can use the form to view/edit, or email, or archive.

View 1 Replies View Related

How To Export Access Table As Outlook Contact Group Without First Using Excel

Aug 6, 2012

I have an Access 2007 SQL database with 20 users. The DB has a list of about 3,000 email addresses that I want to export to Outlook for mass mailing. I've already got the services of an SMTP mail service that allows 1000 mails at a pop to be sent, and I've already written in the logic to separate the list into groups of 1k.

The problem I'm having is that I'm currently exporting from Access 2007 to Excel 2003 format (for some unknown reason Outlook 2007 does not directly interface with Access 2007), and then I have to manually go through the import steps within Outlook to bring the data from each 1k name group spreadsheet into a contact group for mailing.

It all works fine as it is, but it's clunky as hell. I want to automate that process, but I'm not very familiar with Outlook. I'm not even sure what the file format is for a group. Surely it must have its own format, like group1.xxx, or something. My ultimate objective is to export straight from access to the .xxx (whatever it is) format, direct it straight to the appropriate folder within Outlook and in the process eliminate the need for the more tedious steps required to import each Excel file within Outlook that I'm currently using.

View 8 Replies View Related

Forms :: How To Disable Edits In General Tab But Not In Calls Tab

Apr 9, 2013

I have a form called Contacts that has two tabs. One is called General adn the other Calls.

In the General tab I have a bound field called CustomerIDdet which can be numeric or alphanumeric. I need to disable edits in the General tab but not in the Calls tab if CustomerIDdet is numeric (and it follows certain additional rules)

I have placed this code in the Onload even for the form:

Code:

If Len(CustomerIDdet) = 9 Then
If IsNumeric(CustomerIDdet) Then
If Right(CustomerIDdet, 4) = 9090 Then
If Left(CustomerIDdet, 1) = 0 Then
'disable editing in the General tab
End If
End If
End If
End If

I know how to disable edits control by control, but can I disable edits in all controls in that tab at once?

View 2 Replies View Related

Modules & VBA :: Event Calls Seemingly Unrelated Procedure

Apr 11, 2014

I have two forms:

frmOpeartions
frmManagers

frmOperations allows the user to assign a manager to an operation by selecting the manager record from a combobox. Occasionally the user may need to setup a new Manager record if one hasn't been setup already. In this case there is a "New" "button" (it's actually a label with an on click event) that the user can click to open frmManagers and add the new manager record.

The code to open frmManagers is:

Private Sub lblNewManager_Click()
DoCmd.OpenForm "frmManagers", acNormal, , , acFormAdd, acDialog
Forms!frmManagers!cboMoveTo.Visible = False
Forms!frmManagers!lblManagers.Visible = True
End Sub

Once frmManagers is open the user creates the new Manager record and then closes the form using a similar label with an on click event:

Code:
Private Sub lblClose_Click()
DoCmd.Close acForm, "frmManagers", acSaveNo
End Sub

frmMangers also has an OnClose event that will refresh any comboboxes on other forms that refer to tblManagers to make sure that new Manager records will be available immediately for the user to choose from:

Code:
Private Sub Form_Close()
If CurrentProject.AllForms("frmPlants").IsLoaded Then
Forms!frmPlants!cboPlantManager.Requery
Forms!frmPlants!cboQCManager.Requery

[Code] .....

So the problem comes when the user clicks the Close label (acting like a button) on the frmManagers. The code successfully closes the form and the on close event successfully refreshes any comboboxes on forms that may be open, but then for some reason it attempts to run again or perhaps continue running the onClick event that opens frmManagers. Since the form is already closed it gets hung up on trying to change the visible properties of the controls and the code fails.

View 6 Replies View Related

Finding Unique Data Using Date Field

Mar 27, 2008

Hi

I have a table called SWAPS which contains information on each user and the different equipment he has been issued. Query at the moment contains 5 fields

Payroll, Surname, Firstname, Mobile No and Date sent.

SQL for this query is as follows

Select Swaps.PR, Swaps.surname,swaps.firstname,swaps.[mobile no],Max(Swaps,[Date Sent] as Lastdate

From Swaps

Group by swaps.pr, swaps.surname,swaps.firstname,swaps.[mobile no]

Order by swaps.pr;



Now when I run this I get the results I want by date so I get



123456 Smith Fred 0788411025 12/3/8

456789 West Bob 012555447854 13/1/8

So it correctly ids all the last dates for me as I want to see the latest issue date for that user. Now I want to add in another column to this query which contains the serial number of the equipment issued and heres where the problem lies. If a user has been issued more than 1 piece of kit, I get all the serial numbers irrespective of date. How do I get it to display the serial number for the latest date?

Thanks

View 2 Replies View Related

Forms :: Finding Records Based On Todays Date

Aug 9, 2013

I'm wondering what would be the best way to update a list of records based on today's date. Right now I have it to open the form based on the LAST record and then navigate to the record they would like to update, I would only like to show what was entered that day.

View 1 Replies View Related

Reports :: Count Number Of Monthly Calls - Average Function In Footer

Jul 7, 2014

I have a report that counts the number of monthly calls. What I would like is an average of the monthly calls in the report footer.

My total for a particular month is =Count([Date]) and I named the unbound control MonthlyTotal.

This is in the DateFooter section of the report.

I then put an unbound control in the report footer and used the expression = Avg([MonthlyTotal]).

Of course when I changed from design view to report view, it asked me for an input of [MonthlyTotal].

I then tried =Avg([Reports]![qryLetterWritersbyDate]![MonthlyTotal]) and while it didn't ask me for an input, there was nothing in the ubound control in the report footer.

I have search for an answer, but all I find is using a query. Is what I am attempting to do possible? If so, how?

View 5 Replies View Related

Queries :: Finding The Next Min?

Jul 6, 2013

Im looking to display the 4 lowest figuers obviously Min is the lowest but how would you dind the 2nd 3rd and 4th Min or is not possible?

View 14 Replies View Related

Queries :: Finding First And Last Value?

Oct 8, 2013

I have a table with assignments if employees to teams.

PositionsID(autowert),EmployeeID, timefrom, timeto, TeamNo

3, 123, 13:30, 16:45, 4
4, 123, 17:00, 19:00, 7
5, 432, 17:00, 20:00, 8
6, 987, 17:00, 19:00, 9
7, 987, 13:30, 16:45, 5
....

Some of the employees can be assigned to more than one team, the assignement is not chronicaly, meaning an earlier timefrom can be assigned later (see Employee 987)

As a resultlist I need following:

123, 13:30, 19:00, 4
432, 17:00, 20:00, 8
987, 13:30, 19:00, 5

I can get out MIN(timefrom) and MAX(timeto) per EmployeeID but not the first teamNo, which is the first team he starts his duty!!

View 11 Replies View Related







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