Results 1 to 9 of 9
  1. #1
    Zipster1967 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2006
    Location
    Wisconsin
    Posts
    19

    Display all records in a form used to enter records

    I have a simple form that just allows the input of new categories in my categories table. I would like a list of all the current records that have already been entered displayed as a list below the form sorted alphabetically so the user can see what categories have already been entered. I want the list to update every time a new record is added without having to leave the form. Is this even possible?

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    anything is possible, but your description is not clear - can you provide an example of what you mean

  3. #3
    Zipster1967 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2006
    Location
    Wisconsin
    Posts
    19
    My database is for a home shopping list and the categories table will hold different food categories like Fruits, Vegetables, Frozen, Meats, Pork, Beef, Canned, etc. I would like the form to have a place to input the categories at the top and as soon as a category was inputted in the top and the return key was hit the category would appear in a list at the bottom (preferably in alphabetical order) I hope that explains what I am looking for more clearly.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    A multi-column combobox could show all category items.

    Adding a record to 'categories' table 'on-the-fly' during data entry requires VBA code. This is what the combobox/listbox NotInList event is for. http://www.fontstuff.com/access/acctut20.htm
    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
    Zipster1967 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2006
    Location
    Wisconsin
    Posts
    19
    Okay. I added the comboBox control to the form and set the RowSource property to the following
    =(SELECT DISTINCT Categories.Category FROM Categories WHERE Categories.Category Is Not Null ORDER BY Categories.Category;)
    But when I open the form it does not display any entries not even the ones already in the table. Did I miss something? My table name is Categories and the field name is Category. The table contains just 2 fields
    ID Autonum integer
    Category Short Text

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Do not use = ( ) .

    Why the filter criteria? Why would any record in this table have Category Null? Set it as required and never can be Null.
    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
    Zipster1967 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2006
    Location
    Wisconsin
    Posts
    19
    If I remove the =() I get the error message "The syntax of the subquery in this expression is incorrect. Check the subquery's syntax and enclose in parentheses."

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    That is odd. RowSource property does not require = ( ) characters. I don't know why you get this. I see nothing wrong with the SQL and there is no subquery.

    However, since Category should be unique in the Categories table, DISTINCT should not be needed.

    SELECT Category FROM Categories ORDER BY Category;
    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
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    just a thought - your detail says you are using 2003 - is that correct? i.e. you are not developing a web app in 2013?

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

Similar Threads

  1. Replies: 12
    Last Post: 02-19-2014, 11:01 AM
  2. Replies: 11
    Last Post: 10-04-2011, 02:29 AM
  3. query won't display records with no related records
    By James Brazill in forum Queries
    Replies: 1
    Last Post: 06-28-2011, 02:10 AM
  4. Replies: 7
    Last Post: 10-20-2010, 04:08 PM
  5. Display ALL records in a form?
    By evander in forum Forms
    Replies: 3
    Last Post: 07-15-2010, 07:59 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