Results 1 to 4 of 4
  1. #1
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93

    Relationships

    Hi,


    I need to make a query that pulls data from two different tables according to a start date of when the records were entered, and an end ate of the last record entered. But I just cant get the relationships right so it pulls the wrong data and sometimes duplicate. If I upload a example would anyone be willing to take a look?
    FunkyG.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about starting with the SQL you have tried and maybe someone will see how to help.

  3. #3
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Ok, good suggestion. Here is the SQl view;

    SELECT tblCalls.[Time Received], tblCalls.[Time Arrived], tblCalls.[Time Cleared], CDate(Left((Right("0000" & [Time Received],4)),2) & ":" & Right((Right("0000" & [Time Received],4)),2)) AS RecTime, CDate(Left((Right("0000" & [Time Cleared],4)),2) & ":" & Right((Right("0000" & [Time Cleared],4)),2)) AS ClearTime, IIf([Time Cleared]<[Time Received],1440+DateDiff("n",[rectime],[cleartime]),DateDiff("n",[rectime],[cleartime])) AS ElapsedTime, tblCalls.[Seniority ID], tblCalls.[Dispatch Date and Time], tblCalls.Location, tblCalls.Source, tblCalls.Activity, tblCalls.Disposition, tblCalls.[Criminal Reports], tblCalls.[Traffic Citation #], tblCalls.[Misd Arrests], tblCalls.[FI's Issued], tblCallType.[Call Type], tblCalls.[Felony Arrests], tblCalls.[Other Reports], tblCalls.[DUI Arrests], tblShiftInfo.[Vehicle Number], tblShiftInfo.District, tblShiftInfo.[Starting Mileage], tblShiftInfo.[Ending Mileage], tblShiftInfo.[Beginning Shift Date], tblShiftInfo.Watch, tblShiftInfo.[Team Number], tblShiftInfo.[Duty Type], tblShiftInfo.[Ending Shift Date]
    FROM (tblShiftInfo INNER JOIN tblCalls ON tblShiftInfo.[Seniority ID] = tblCalls.[Seniority ID]) INNER JOIN tblCallType ON tblCalls.[Call Type] = tblCallType.[Call Type ID]
    WHERE (((tblCalls.[Seniority ID])=[Please enter your seniority ID:]) AND ((tblCalls.[Dispatch Date and Time]) Between [Please enter your shift start date:] And ([tblCalls].[Dispatch Date and Time])=Date()));

    I need to be able to use a start date and an end date to pull all data that was input between those dates. Hopefully this makes sense.
    FunkyG

  4. #4
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    The SQL statement shows Three Table
    1:tblCalls
    2:tblShiftInfo
    3:tblCallType
    Your Query shows these table are simply Join (Inner Join) but no relationship between them.
    1:You need to Define Relationship betwen Tables as 1-1 , 1-many, many-many etc.
    that need DATA in table and how these data are related to data in other table.
    2:Redifine your table in your query. ( Delete and add table) Modify the fields again.
    That should show the correct DATA in table
    Hope that will solve your issue.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Relationships
    By neo651 in forum Database Design
    Replies: 2
    Last Post: 08-30-2011, 08:38 AM
  2. Relationships I think
    By darlaj5 in forum Access
    Replies: 2
    Last Post: 05-04-2011, 08:37 PM
  3. One to many relationships
    By CoachBarker in forum Database Design
    Replies: 1
    Last Post: 09-13-2010, 09:01 PM
  4. Too Many Relationships
    By MikeT in forum Database Design
    Replies: 4
    Last Post: 08-25-2010, 07:23 PM
  5. Relationships?
    By rosh41 in forum Database Design
    Replies: 2
    Last Post: 06-23-2010, 01:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums