Results 1 to 4 of 4
  1. #1
    dpasanen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    6

    Form with data from a query and a table

    I'm having trouble trying to get data from a table and a query onto the same form.
    I use the table for most of the data, but there are a couple calculated fields on a query that I want on there as well.

    Whenever I point to the query field for the text box, I get: #NAME?

    I've got a relationship set up between the two that should be correct.

    Any help would be greatly appreciated!

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    It would be better to use the domain aggregate functions to pull data from the query into the form. I assume that the data in the query is related somehow to the data shown in the form, so you will need some criteria. There are several domain aggregate functions, I assume that you will want the Dlookup() function. Some of the other common ones are DMax(), DMin(), DAvg(), DCount().

    The control source for your textbox would look something like this. The syntax of the domain aggregate functions is a little tricky, so please take a look at the help section and it would be best to use the expression builder when first starting out.

    =DLookup("fieldname", "queryname", "fieldname=" controlname)

  3. #3
    dpasanen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    6
    Ah, perfect! Thanks jzwp11!

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome

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

Similar Threads

  1. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  2. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  3. Replies: 1
    Last Post: 12-15-2011, 04:26 AM
  4. Replies: 4
    Last Post: 01-05-2011, 07:56 AM
  5. Data in table but not in form or query
    By jennie999 in forum Forms
    Replies: 5
    Last Post: 10-13-2010, 09:10 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