Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Sep 2010
    Posts
    22

    Arrow Populate table after DLookup is performed

    Happy Friday Everyone!

    Wondering if someone can point me in the right direction. This question involves two tables and one form. One table contains static data (such as part number, description, cost, etc.). The other table is a more dynamic table that contains history about activities. The form builds the dynamic table from data in the static table.

    I use a dlookup to populate the form, now I want to know how to put that data in my dynamic table.

    Any help is greatly appreciated.

  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
    If the two tables have a Relationship then there is no reason to put anything but a ForeignKey in the table. A query that joins the two would allow you to see and treat all of the fields of both tables as if they were in the same table.

  3. #3
    Join Date
    Sep 2010
    Posts
    22
    It seems that works great when there is a one-to-one relationship, however in two of my fields there are multiple choices in the static table to choose from and the database errors because it doesn't know which one to pick. In the form I have it narrowed down to a single choice. Is there no way in the Control Source to say "do this DLookup and then put the data over in this other table"?

  4. #4
    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
    As I stated earlier, there is no reason to use a DLookup() if the tables are related properly. You are not using Lookup Fields are you? http://www.mvps.org/access/lookupfields.htm

  5. #5
    Join Date
    Sep 2010
    Posts
    22
    Starting to feel a little woozy here...thus the username.

    A tutor taught me to create relationships to tables using the Lookup feature in Access. Is this the same Lookup you are talking about?

  6. #6
    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
    Lookup Fields are in tables and not a good way to go. Most developers avoid them like the plague.

  7. #7
    Join Date
    Sep 2010
    Posts
    22
    I understand that my tables may not be setup correctly, they are foundational. I have tried to avoid the DLookups without any success. Is there any way you can assist me where I am?

  8. #8
    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
    It is all achievable but I need to know if you are using any Lookup Fields. If so then we need to eliminate them first. http://www.btabdevelopment.com/ts/removelookups

  9. #9
    Join Date
    Sep 2010
    Posts
    22
    Hi RuralGuy,

    Sorry for the delay in responding, this Southerner didn't take too kindly to Mother Nature the past few weeks. I am finally getting caught up and I have removed all of the lookups in my database. There were quite a few. Once removed I tested the database's functionality and all seems to be well.

    Just a quick recap....

    I am using a dlookup to populate a form and I want the item that was retrieved to go into another table (history gathering kinda thing).

    Looking forward to hearing from you.

  10. #10
    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
    Quote Originally Posted by OMGsh Y did I say Yes View Post
    I am using a dlookup to populate a form and I want the item that was retrieved to go into another table (history gathering kinda thing).

    Looking forward to hearing from you.
    I'm not sure how you are using this but it can be done with a DLookup() if that's what you need. Where did you put this DLookup()?

  11. #11
    Join Date
    Sep 2010
    Posts
    22
    I have a table of reference data. Using a form I pull existing data using the dlookup and it shows up on the form. Beautiful. What I would like to do is take the data that I received from the dlookup and place it into a table (different table) that I use for tracking. Why? Because I am pulling up multiple combinations of data and would like to create a history per se.

  12. #12
    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
    So you are fetching values from a table (not the RecordSource of the form) and you want to store those values in another table (not the RecordSource of the form)? It that is true then you will need to use a query to store the values.

  13. #13
    Join Date
    Sep 2010
    Posts
    22
    In my attempts to create the form based on a query, I am afraid I have not been successful. This form seems too customized to fit into that category. I have heading data that is derived from three different tables (chosen by user) and the subform details are also derived from three different other tables with filtering for the items that have many variables available.

    Here is the basic process of the form...

    Header:
    Creates a document id (automatic new record)
    Database inputs date
    User chooses Company (drop down)
    Database filters Contacts for that Company
    User chooses Contact (drop down)
    User chooses Sales Rep (drop down)

    Subform - Details
    User chooses Part
    Database inputs description (dlookup)
    Database filters services for part chosen
    User chooses service (dlookup)
    Database inputs time (dlookup)
    Database inputs cost (Dlookup)
    User types in quantity
    Database extends cost (calculation)
    Database compares cost to new (calculation/dlookup combo)

  14. #14
    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
    You are making this way more complicated than it need be. Can you make a query that returns the values you need from the tables involved in the DLookup's?

  15. #15
    Join Date
    Sep 2010
    Posts
    22
    The query that I make returns too many values because of the many-to-one relationship.

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

Similar Threads

  1. DLookup to populate form
    By OMGsh Y did I say Yes in forum Forms
    Replies: 2
    Last Post: 12-09-2010, 01:05 PM
  2. Replies: 10
    Last Post: 05-19-2010, 10:34 AM
  3. Replies: 2
    Last Post: 02-14-2010, 01:38 PM
  4. How do I get dlookup values to store in table
    By rpmyhero in forum Access
    Replies: 1
    Last Post: 11-25-2009, 05:57 AM
  5. Use form to populate a table from another table
    By sammer021486 in forum Forms
    Replies: 3
    Last Post: 09-28-2009, 09:06 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