Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26

    Question Can you set a subform's record source to anything else beside a query?

    The query for my subfile record source is getting too complicated as it pulls data from a lot of tables. Is there a way I can link the subform to a Collection which I can build by using code rather than by query?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Never heard of such a thing. Don't think so. Collection of what?

    Since normally a form can do data/entry for only one table, RecordSource should not be so complicated. Why is it 'getting complicated' - why so many tables?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    I was thinking a Collection of a Class I have set up, which contains all the info from several tables for a specific job.
    I have an application in which the main form has about 8 tabs, which represent the various stages of a job (enquiry, quote, contract to be done, contract sent, contract accepted, etc.). Each tab is a subform, for which a query pulls data from Job, Client, Address, Town, PostalCode, JobContract, JobSite, and several more tables. This is complicated even more by comboboxes on the main form to select data ranges , Client type, and job type.

    Anyhow, it appears from your answer that it can't be done, so I'll have to think of something else. Thank you.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    If your subform is a datasheet view (or you are happy for it to be so), you can just set the sourceobject of the subform control to the name of your query

    e.g. query.myquery

  5. #5
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    My query is exactly the problem - one of the queries currently is:
    SELECT q_JobContract_ActJob.ContractJob, q_JobContract_ActJob.AJJobClosedDate AS [Closed Date], q_JobContract_ActJob.JobQuoteOptionNo AS Opt, q_JobContract_ActJob.JCTotalPrice AS [Total Price], q_JobContract_ActJob.JCSignedContractHeld AS Signed, q_JobContract_ActJob.AJPlannedEndDate AS [End Date], q_JobContract_ActJob.AJApprovalWCRef AS [WC Ref], q_ClientDtls.FullName AS Name, q_ClientDtls.CLMobile AS Mobile, q_ClientDtls.CLOtherPhone AS Phone, q_ClientDtls.CLEmailAdd AS [Email Address], q_siteAddress.GAStreetAddress AS [Site Address], q_siteAddress.TPTown AS Town, q_ClientDtls.CLType, q_JobContract_ActJob.ClientID, q_JobContract_ActJob.AJobID, q_JobContract_ActJob.AJTypeID, q_JobContract_ActJob.JobStageID, q_JobContract_ActJob.JCScopeOfWork AS [Scope of Work]
    FROM q_ClientDtls, q_siteAddress, q_JobContract_ActJob
    WHERE (((q_JobContract_ActJob.ClientID)=q_ClientDtls.Cli entID) And ((q_JobContract_ActJob.AJobID)=q_siteAddress.AJobI D) And ((q_JobContract_ActJob.JobStageID)=80) )
    ORDER BY q_JobContract_ActJob.AJActualEndDate DESC , q_ClientDtls.FullName;

    one of the queries used in this query (q_JobContract_ActJob) is:

    SELECT ActJob.AJobID, ActJob.AJTypeID, ActJob.JobStageID, JobContract.AJobID AS ContractJob, JobContract.JobQuoteOptionNo, JobContract.JCTotalPrice, JobContract.JCScopeOfWork, ActJob.ClientID, ActJob.SiteAddressID, ActJob.AJPlannedStartDate, JobContract.JCSignedContractHeld, ActJob.AJPlannedEndDate, ActJob.AJApprovalWCRef, ActJob.AJActualEndDate, ActJob.AJJobClosedDate
    FROM JobContract INNER JOIN ActJob ON (JobContract.JobQuoteOptionNo = ActJob.JobQuoteOptionNo) AND (JobContract.AJobID = ActJob.AJobID);




    I know for a fact that this series of queries sometimes does not give the correct result, but to debug it is a nightmare. That's why I want to get away from queries.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You are bombarding readers with SQL and How you have attempted to do something, which you indicate is not how you want to continue. I suggest you tell us in plain English, business terms --no Access, no SQL and no jargon -- what exactly you are trying to do. There may be options, but we can't determine that until we understand WHAT your business requirements are.

  7. #7
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    Ok, sorry you didn't get my ideas. Here it is in plain english:

    The application controls construction jobs from enquiry stage through job completion.

    When the application starts, the user is presented with a screen called the control centre, which has tabs across the top which represent the different stages a job can have:
    dropped, enquiry, being quoted, contract being drawn up, contract sent for approval, contract accepted, job scheduled, job active, and job completed.

    When clicking on any tab, a list is shown of all jobs that are currently in that job stage. Also on top of the screen is a series of selections the user can make such as date, job type, client type - which further control which jobs are displayed in the list.

    The lists are not input-capable. Next to each job in the list is a button, which either brings up a new screen with further details or an edit screen, depending on which tab was selected.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I don't understand why need such complex queries. I presume control centre form is not bound. User enters/selects values and code opens appropriate form for record entry/edit. Form does entry/edit for 1 table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    No, Control centre form is not bound.
    The reason why the queries are complex is that for each list (tab) the job details displayed comes from several tables. The user needs to see all this information to identify which job to select.

    That is the only part that's causing me problems: to present all the required information in each tab. I posted the SQL earlier to show how complex the queries are (for me, anyway. Maybe this is quite normal.)

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Well, can't get away from queries.

    If you have queries based on queries based on queries as RowSource for listboxes, I am not surprised you are having difficulty.

    Here is example of conventional search utility http://www.allenbrowne.com/ser-62.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    jpg250,

    I got your ideas but I had no idea where all the SQL and queries fit within a business context. I still don't quite understand why most fields in your query have an alias.

    When a post identifies complexity as an evolving issue, the first flag that jumps up is --are the tables normalized? Not that normalization alone simplifies queries, but it's a good starting point for several issues.

    **Can you post a copy of your tables and relationships (a screen capture of your relationships window)?

    To paraphrase your comments:
    Code:
    You are in the construction business.  You manage construction jobs where each 
    job goes through a number of defined stages -namely:
    
    dropped
    enquiry
    being quoted
    contract being drawn up
    contract sent for approval
    contract accepted
    job scheduled
    job active
    job completed
    
    Currently you have a form that, based on a selected stage, presents a read-only list
     of all jobs that are currently in that job stage. 
    The list may be filtered/constrained by selecting parameters such as date, job type,
     client type. 
    
     Next to each job in the list is a button, which either brings up a new screen with
     further details or an edit screen, depending on which tab was selected.
    Questions:
    How does data get into the current system? You mentioned lists are not input-capable.
    Can a job be dropped at any stage or only certain stages?
    Who updates the job stage info?
    Where do Customers and Job details get stored in relation to these "job management form(s)"?

  12. #12
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    Thanks orange,

    I really appreciate your help, but please don't spend too much time on this. I didn't want to get into this much detail, and I can get by with the way it is.


    In answer to your questions:

    How does data get into the current system? - there are separate forms for this, which the user can get to from either the main form or from other input forms.
    My input forms are not bound either - so I have more control over what goes in.

    Can a job be dropped at any stage or only certain stages? Can only be dropped before contract accepted.
    Who updates the job stage info? The users do - with buttons. Some on tabs, others on input forms.
    Where do Customers and Job details get stored in relation to these "job management form(s)"? Not sure what you mean. I have a backend where all the tables are.


    this is the diagram:
    Click image for larger version. 

Name:	relationships.jpg 
Views:	11 
Size:	207.8 KB 
ID:	21509

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Arghh! Compound keys and possible circular relationships. No wonder you are going nuts! http://www.codeproject.com/Articles/...atabase-Design
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    jpg250 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    26
    Thanks for your contributions June7. I'm almost sorry I started this post. Do you have any experience with tempoary tables? This was one of the options I considered : to create a temporary table for each of the tabs, load the data into it using code instead of query, bind it to the subform for the tab, and then delete the records again if another tab is selected. I then thought may run into problems doing this because of: 1. performance 2. bloating the database size 3. multiple users using the application at the same time.

    (Maybe it's against the rules to ask a differen question at this stage. If so, I'm sorry.)

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Yes, I use temp tables for some complex rearrangement of data for output to reports. Not for any other purposes.

    Multi-user database should be split. Temp tables would be in the frontend. Bloating should not be an issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-14-2014, 04:08 PM
  2. Replies: 6
    Last Post: 08-21-2013, 02:51 PM
  3. Replies: 14
    Last Post: 05-25-2012, 02:40 AM
  4. Replies: 6
    Last Post: 05-05-2012, 08:43 AM
  5. Replies: 16
    Last Post: 01-16-2012, 09:43 AM

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