Results 1 to 11 of 11
  1. #1
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6

    Reference query results in a Main Form

    I would like to reference a field from a Totals query named: [s- PotableWtrMainsCompletedSinceLastReport]. The field is named: [Length].
    I want to reference that field on a Main form but am not having any luck. I know I'm probably mixing up the syntax. Hopefully someone can help. Thanks :-)

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Show what you have attempted.

    Options:

    1. include query in form RecordSource

    2. DLookup domain aggregate function referencing the Totals query or a DSum referencing the raw data table/query
    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
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6
    Thanks for your quick response. I think I need to be more specific. I apologize.
    There are two queries that I am actually trying to access from the main form so adding the query to the data source for the form won't work. Both queries are totals queries which access two separate data tables and they both have a parameter being run for the user to enter a [> date]. I tried the DLookup but I don't think it works when the query has a parameter in it.
    If this isn't clear then I will have to clean up the database for sensitive information and attach it. Thanks again for your help!!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I never use query popup parameter input - too hard to validate user input. Better to have form for input and query references form control as parameter. Then I think the DLookup will work.
    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.

  5. #5
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6
    I don't really have time to re-engineer the form if possible. I'm not sure how to create the method you suggest. I have always created parameters right in the query. What would the process be to use your method?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Query parameters reference controls on form. For user input the controls would be unbound, in form header section.

    Review

    http://datapigtechnologies.com/flashfiles/buildcustomfilter.html

    http://datapigtechnologies.com/flash...earchform.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.

  7. #7
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6
    OK. I created an input form to capture the parameters for the dates and modified my queries to grab them. The DLookup fuction now works on my original Main form, however, those numbers are showing up as 0 on my report. I am using a =Get() function to retrieve them because my main report is bound to a crosstab query. I am also pulling several other numbers that are variable and need to be entered manually and those fields are also being retrieved with a =Get() function. The only piece left now is to get those two numbers that are being retrieved with the DLookup to show up properly on my report. Sorry to be such a pain. I appreciate your help!!

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why are they 0 on the report? What is the textbox ControlSource? Is it a DLookup or is it reference to control on form? Get() is a custom function? How does this retrieve data? Show the function code.

    If you want, can provide db for analysis. Follow instructions at bottom of my post. Identify the objects involved in 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.

  9. #9
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6
    My database is larger than 2MB even when zipped. I have taken screen shots of my code and attached it. Hope this helps.
    Attached Thumbnails Attached Thumbnails =Get().PNG   Form Variables.PNG   Global.PNG   Report.PNG  

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Too hard to follow, can't test code.

    Those globals and functions are in a general module?

    You ran Compact & Repair first? Could make copy and remove most data.

    Alternative is upload to a fileshare site such as Box.com and post link to the file.
    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
    Mischief1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    6
    I figured it out...I think... Thanks for your help!!

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

Similar Threads

  1. Replies: 2
    Last Post: 12-16-2012, 02:35 PM
  2. Replies: 1
    Last Post: 07-20-2012, 09:48 AM
  3. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  4. Replies: 3
    Last Post: 03-11-2012, 08:24 PM
  5. Replies: 6
    Last Post: 11-17-2011, 10:50 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