Results 1 to 6 of 6
  1. #1
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Which would be more efficient

    I have a form with a subform on it which is linked to a different table than the parent form. I want to display info from the subform on the parent form. Is it more efficient to use a reference to the subform on the parent form textbox (=[subform]![control]) or use a =dlookup() based on the currently selected record id on the subform?



    There are about 12 text boxes that need info from this subform/other table.

    Can I use all dlookups instead of the subform or is it better to use a subform

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm confused. Why do you need to display 12 fields from a SubForm on a MainForm when they are already being displayed on the SubForm?

  3. #3
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187

    Re: Which would be more efficient

    They are not being displayed, this subform is hidden and the record is selected based on the record selected on the parent form (pk of the subform table is linked to a key in the parent form/table)

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would think referencing the SubForm would be more efficient since each DLookup would require another query.

  5. #5
    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,716
    Perhaps you should step back and tell us in plain English WHAT you are trying to do. You are telling us a little of HOW you have done something. Once readers know WHAT you are trying to achieve, there may be options.

  6. #6
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Quote Originally Posted by orange View Post
    Perhaps you should step back and tell us in plain English WHAT you are trying to do. You are telling us a little of HOW you have done something. Once readers know WHAT you are trying to achieve, there may be options.
    Ok, my database is an event management db where we enter events that take place at various companies. Some events are re-occurring at particular companies so instead of storing duplicate data, there is a companies table so each company could be re-used. My main form is for event entry. I have company name in a combobox where it queries all companie names from the company table. I have textboxes on the form for the remaining company info (address, city, state zip, misc other info).

    I have a hidden subform on the event entry form that is bound to the companies table, with the primary company key linked to the company key in the event db. When a company is selected in the combobox (or an event is selected), the subform retrieves from the company table, the company info (address, city, state, zip).

    Currently, I have the company info textboxes (on the main entry form) retrieving the company info from the hidden subform. My initial question is am I doing this properly, or should I use DLookUp to get the other company info (address, city, state) based on the company ID?

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

Similar Threads

  1. Most Efficient Way to Accomplish Task
    By cc143most in forum Access
    Replies: 2
    Last Post: 08-24-2012, 02:17 AM
  2. Need help making my code more efficient
    By themidnitereign in forum Programming
    Replies: 3
    Last Post: 08-10-2012, 11:06 AM
  3. More efficient way to create a query?
    By Kirsti in forum Queries
    Replies: 3
    Last Post: 07-04-2012, 10:36 PM
  4. More efficient way of repeating code
    By karmacable in forum Programming
    Replies: 2
    Last Post: 09-12-2011, 12:43 AM
  5. Efficient Process?
    By compooper in forum Database Design
    Replies: 1
    Last Post: 06-14-2011, 03:01 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