Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12

    List or Combo Box ?

    Windows 7, Access 2000
    I want to use one or the other to get info out of a table by clicking on a word in the box.


    The table has record 1,2,3,4,5 ect. the form box has a combo box that gets the records list from the table. I want to set it up so if I click on record 1 it will open a different form and show that record?

  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,929
    VBA code in the AfterUpdate event of the combo or list box.

    DoCmd.OpenForm "form name", , , "field name=" & Me.combo or list box name
    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
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    DoCmd.OpenForm "Beef", , , "field name=" & Me.combo1

    Private Sub Combo1_AfterUpdate()
    DoCmd.OpenForm "Beef" this part opens the form, but the rest of it causes an error , , , "field name=" & Me.Combo1
    End Sub

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    What error message exactly?
    What value was selected in the combobox?

  5. #5
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    In the combobox there is a list
    Chi
    bfs
    spg
    Pe
    They all come back with compile error

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Can you post a sample of your database-- just enough data to show the issue?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Instead of 'field name' use real name from your table. I used a generic alias because I don't know your data structure. Also, the data is text so need apostrophe delimiters.

    "field name='" & Me.Combo1 & "'"
    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.

  8. #8
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    How do I post a copy of data base?

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The Attachment Manager is located below the Advanced post editor.
    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.

  10. #10
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    It comes back saying the file is over 500KB
    and doesn't attach.
    In my table I have these records
    Chi
    bfs
    spg
    Pe
    On the form I have 1 combobox it is populated from the table. When I open the combobox and click on one of the list I want it to open frmBeef and show that file.

    "field name='" & Me.Combo1 & "'" comes back needs a number 1 for chi 2 for bfs Ect.

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you run Compact and Repair? If still too large can zip. Zip of 2mb allowed.

    Did you change 'field name' to real name from your table?

    What does 'comes back needs a number 1 for chi 2 for bfs Ect' mean?
    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.

  12. #12
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    Error message in debug

  13. #13
    Lbs is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Dec 2011
    Location
    Tn.
    Posts
    12
    I hope this attached

  14. #14
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I'll look later

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Your data structure is wrong. You have 9 tables with identical fields. These can be one table with one additional field: RecipeType. The values in this field would be: beef, cake, casserole, chicken, deserts, pastry, pie, pork.

    Check this http://office.microsoft.com/en-us/te...001018635.aspx

    Regardless of the above, the VBA code (according to prior instructions, except no apostrophe delimiters because turns out the criteria is numeric) should be:
    DoCmd.OpenForm "Beef", , , "ID=" & Me.Combo1
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Clear value list in combo box
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 05-27-2011, 12:45 PM
  2. Combo/List box question
    By wacky1 in forum Forms
    Replies: 2
    Last Post: 05-22-2011, 09:07 PM
  3. Combo List
    By gbwiii in forum Forms
    Replies: 1
    Last Post: 05-19-2011, 10:46 PM
  4. Combo box for list
    By Danzig in forum Forms
    Replies: 6
    Last Post: 11-03-2010, 05:18 PM
  5. combo box value list
    By thewabit in forum Forms
    Replies: 13
    Last Post: 01-13-2010, 07: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