Results 1 to 6 of 6
  1. #1
    BjornDenmark is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Location
    Denmark
    Posts
    4

    Form starting report based on dropdown does not take the value

    New to Access I am missing something.



    I have a form using a dropdown-component based on a query.
    The form has a button which start a report based on another query (DoCmd.OpenReport ...)
    This report has a criteria build to be based on the dropdown-components value.

    The value in the dropdown is OK (MsgBox myDropDown shows correct), but mostly the report comes up empty (2 times it worked, but only once)

    I have tried to build a form with an edit-component instead of dropdown, then it works, so I do not understand the difference.

    Hope someone is able to point me in the right direction.

    Thank you
    Bjorn

  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,628
    What do you mean by 'edit-component instead of dropdown'? No idea why code fails. You did not post any for analysis. Also, what is the actual value of the combobox? Is it a multi-column combobox?

    If you want to provide the db, follow instructions at bottom of my post.
    Last edited by June7; 08-11-2014 at 11:04 AM.
    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
    BjornDenmark is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Location
    Denmark
    Posts
    4
    Hi,
    It is a code/value-combobox, where the code should be passed to the query as criteria.

    What I tried was to place a textbox instead, and then rebuild the criteria to this textbox instead. But now this works only first time, second time I put a value in the box the report shows up empty.
    And when I close the database and reopens, it does not work at all.
    So somehow the connection between the form-fields (textbox / dropdown) and the query is not stable, when I change the criteria to prompt for value, everything works.
    Unfortunately I am not able to provide the db, but I will try to make a test-db and see if I can reproduce the problem.
    Thank you.
    Bjorn

  4. #4
    BjornDenmark is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Location
    Denmark
    Posts
    4
    Hi again,
    I have now tried to make a new database with 2 tables, a query, a form and a record to illustrate the problem - but the problem is that there is no problem, it works as designed and expected ;-)

    The database I am trying to make my dropdown in, is not a database I have made, I was just asked to change a criteria to a dropdown, and chose to make a form to call the report through.
    I have tried to mimic the design from the database, where the query and the report is of course much more complicated.
    I know nobody probably are able to tell me what is wrong, but I hope, somebody is able to point me in a direction on how to debug this?

    Basically my problem is:
    I build a criteria in the query pointing to a dropdown in a form.
    The dropdown is feeded from a table (code/value-table, key-field not hidden) - and shows the correct values.
    The start-button in the form calls DoCmd.OpenReport <Report>
    <Report>'s datasource is the query where the criteria is pointing to the forms dropdown-field

    Now the querys criteria on runtime is not feeded with the value from the form, and I do not understand why.

    Again - I tried to illustrate it with a small example-database where I use exactly the same technique, but this has no problem.

    Hope someone is able to tell me where to look / debug.

    Thank You
    Bjorn

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    Is the combobox UNBOUND? Controls used to input filter criteria must be UNBOUND, otherwise you change data in record.

    What is the value of combobox? What is the field in report the combobox parameter is applied to?

    Beyond that, would have to analyse db.
    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.

  6. #6
    BjornDenmark is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Location
    Denmark
    Posts
    4

    Solved

    Yes it is unbound. But the problem is solved.
    It was a combination of corrupt data, and the way the query was constructed (it was supposed to always return data, but it did not - inner joins)
    Thank you for your time.
    Best regards
    Bjorn

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

Similar Threads

  1. Calculating number of items based on dropdown
    By arstueck in forum Queries
    Replies: 3
    Last Post: 06-14-2014, 01:51 PM
  2. Replies: 2
    Last Post: 06-25-2013, 08:35 AM
  3. Replies: 11
    Last Post: 05-28-2012, 05:47 AM
  4. Replies: 6
    Last Post: 02-24-2011, 03:24 PM
  5. Replies: 2
    Last Post: 08-03-2010, 10:16 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