Results 1 to 2 of 2
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    318

    connecting SQL code for a Query

    I need to add to this code becuase not only do I want to look up the Fiscal Year for the "Last Signature Date", I also want to calculate when the "Next FSA Due" is due by taking the "Last Signature Date" and times it by a number of years depending on the entry in another field. Then I want to look up the Fiscal Year for the "Next FSA Due".

    Can you do it all in one Query or do you have to have Sub Queries? If you can do it in one Query how do you connect the coding?



    SELECT Tbl_Building_Information.Bldg_Number, Tbl_Building_Information.FSL, Tbl_Building_Information.Last_FSA, Tbl_Building_Information.Last_Signature_Date, Tbl_Building_Information.Bldg_Name, Tbl_Building_Information.Address, Tbl_Building_Information.City, Tbl_Building_Information.State, Tbl_Building_Information.Zip, Tbl_Building_Information.Commander, Tbl_Building_Information.Inspector_First_Name, Tbl_Building_Information.Inspector_Last_Name, Tbl_Building_Information.On_Schedule, Tbl_Building_Information.District, Tbl_Building_Information.Delegated, Tbl_Building_Information.Population, Tbl_Building_Information.Owned_Leased, Tbl_Building_Information.Lease_Exp_Date, Tbl_Building_Information.Sq_Feet, Tbl_Building_Information.GSA_Contact, Tbl_Building_Information.Notes, Tbl_Building_Information.In_Ramp, Tbl_Building_Information.In_EIS, Tbl_Building_Information.FPS_Responsible, Tbl_Building_Information.Review_Date, Lookup_Tbl_Fiscal_Year.FY
    FROM Tbl_Building_Information LEFT JOIN Lookup_Tbl_Fiscal_Year ON Tbl_Building_Information.[Last_Signature_Date]>=Lookup_Tbl_Fiscal_Year.Start_Date AND Tbl_Building_Information.[Last_Signature_Date]<=Lookup_Tbl_Fiscal_Year.End_Date

    Could I not do this as a calculated control in the form itself? Would the expression be =[Tbl_Building_Information].[Last_Signature_Date]>=[Lookup_Tbl_Fiscal_Year].[Start_Date] And [Tbl_Building_Information].[Last_Signature_Date]<=[Lookup_Tbl_Fiscal_Year].[End_Date]
    Last edited by Huddle; 02-08-2012 at 02:09 PM. Reason: additional question

  2. #2
    admessing's Avatar
    admessing is offline GIS DBase Tamer
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Northern CO
    Posts
    79

    Cleaned up so the rest of the world can read it:

    Your SQL:
    Code:
     SELECT 
    Tbl_Building_Information.Bldg_Number, 
    Tbl_Building_Information.FSL, 
    Tbl_Building_Information.Last_FSA, 
    Tbl_Building_Information.Last_Signature_Date, 
    Tbl_Building_Information.Bldg_Name, 
    Tbl_Building_Information.Address, 
    Tbl_Building_Information.City, 
    Tbl_Building_Information.State, 
    Tbl_Building_Information.Zip, 
    Tbl_Building_Information.Commander, 
    Tbl_Building_Information.Inspector_First_Name, 
    Tbl_Building_Information.Inspector_Last_Name, 
    Tbl_Building_Information.On_Schedule, 
    Tbl_Building_Information.District, 
    Tbl_Building_Information.Delegated, 
    Tbl_Building_Information.Population, 
    Tbl_Building_Information.Owned_Leased, 
    Tbl_Building_Information.Lease_Exp_Date, 
    Tbl_Building_Information.Sq_Feet, 
    Tbl_Building_Information.GSA_Contact, 
    Tbl_Building_Information.Notes, 
    Tbl_Building_Information.In_Ramp, 
    Tbl_Building_Information.In_EIS, 
    Tbl_Building_Information.FPS_Responsible, 
    Tbl_Building_Information.Review_Date, 
    Lookup_Tbl_Fiscal_Year.FY
    FROM Tbl_Building_Information LEFT JOIN Lookup_Tbl_Fiscal_Year 
    ON Tbl_Building_Information.[Last_Signature_Date]
    >=Lookup_Tbl_Fiscal_Year.Start_Date AND 
    Tbl_Building_Information.[Last_Signature_Date]
    <=Lookup_Tbl_Fiscal_Year.End_Date

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

Similar Threads

  1. Connecting to a new table in the BE
    By Jamescdawson in forum Access
    Replies: 5
    Last Post: 02-06-2012, 03:57 PM
  2. connecting two tables?
    By imintrouble in forum Access
    Replies: 1
    Last Post: 01-24-2012, 02:22 PM
  3. connecting excel to access
    By metokushika in forum Access
    Replies: 1
    Last Post: 10-31-2011, 06:14 AM
  4. Connecting MS-ACCESS to SharePoint
    By lim_sup in forum SharePoint
    Replies: 1
    Last Post: 09-05-2011, 09:45 AM
  5. mysql connecting help....
    By alex_raju in forum Access
    Replies: 1
    Last Post: 07-18-2011, 07:22 PM

Tags for this Thread

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