Results 1 to 10 of 10
  1. #1
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21

    need to display combo box selection match on the form instead separate query/datasheet view

    I created a form where it takes all the field from a table and displays.
    than I created a combobox on header of the form and fill distinct value from one of the field of that table.
    I wrote a code in combobox change() property which opens a query (query has condition will display record which matches with the combobox)

    Every thing works fine except when I select selection from combobox to display the result instead of displaying in that form it opens new datasheet view and display the result.



    I want to display the result in the same form in Tabular format.

    please let me know if it is possible

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The query would have to be the form's RecordSource.

    I prefer this method: http://www.allenbrowne.com/ser-62.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.

  3. #3
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    if i put the query in form RecordSource than it does not work.
    I removed the open query from combobox event (after change) and put the open query in recordsource of form properties. But if there is nothing in the combobox event than how it it is going to check what to open when you make combobox selection

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I NEVER use dynamic parameterized queries. My preference is the Allen Browne example.

    Post the SQL of your 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.

  5. #5
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21

    Attach Sample Database with small problems need help!!

    Database1.zip

    So attach is Database1.zip file which has Database1.accdb database.
    If you open it you will see 1 table, 3 queries, two forms, 1 macro.

    By Default it should open MainFrm so double click on mainform to open it than you can click StudenFrm which will show you another form.
    In the new opened form which shows the student list there is combo box on the top.
    If you select the value from combo box (for e.g. north) it does open all the records which are in north region but....
    Problem NO. 1 : it opens in separate datasheet window instead of on the same form in tabular format like you see in design.

    how to get display on the form in same window instead of separate datasheet ?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    NOTE: merged threads

    Answer is the same: query must be the form's RecordSource.

    Modify WHERE clause to:

    WHERE ((([Student1].Region) LIKE [Forms]![SubFrm]![Combo29] & "*"));

    And change the button macro code to open form instead of 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.

  7. #7
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21

    made changes as per your recommendation but not working

    sorry about duplicate threads.....accidental...

    but i made changes as you mentioned and now it is not doing anything when i make combo box selection.
    can you please unzip db and check, as i am attaching db again.
    thanks
    Attached Files Attached Files

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The combobox macro needs to refresh/requery the form, not open - the form is already open.

    I couldn't figure out the macro - I don't use macros, only VBA:

    Me.Requery
    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
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    not sure why i can't make it understand.
    Please ignore the macro which is in database, do not pay attention.
    I have created macro to export the desired result to export in excel.
    that macro has nothing to do with problem i am mentioning
    None of my two forms (main and subform) is linked with macro. Neighther combo box is linked with macro.
    Please do not get confused with additional objects in the database.
    I just needed simply to refresh the data in the 2nd form (subform) instead of opening combobox selection in separate datasheet view

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I gave you solution. Need code (macro or VBA) to refresh/requery the form. I couldn't get macro to work. I provided VBA syntax.
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-18-2013, 09:14 PM
  2. Replies: 6
    Last Post: 11-21-2012, 05:10 PM
  3. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  4. Replies: 1
    Last Post: 02-03-2012, 03:51 PM
  5. synch 2 combo boxes in datasheet view
    By kapplers in forum Forms
    Replies: 2
    Last Post: 11-09-2009, 09:09 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