Results 1 to 4 of 4
  1. #1
    dssrun is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    83

    Updating ListBox from OptionGroup

    I am having trouble with this code. When I click on "Form View", and hit the appropriate option button, my listbox AfterUpdate() is blank. However, when i submit the form the value shows up in my database that is in the listbox because I can select different blank rows in my listbox.



    Code:
    Private Sub Frame24_AfterUpdate()
    
    Dim MySQL As String
    Dim MyCriteral As String
    
    MySQL = "SELECT Facility FROM Facilities WHERE " & MyCriteria
        
    Select Case Me.Frame24
            Case Is = 1   
                MyCriteria = "System = ""Customers"" "
            
            Case Is = 2
                MyCriteria = "System = ""Employer"" " 
        
    End Select
    
    Me.List35.RowSource = MySQL & MyCriteria
        
    End Sub

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    MyCriteria is already in the MySql statement...not sure why you append it separately again.... shouldn't it be?:

    Me.List35.RowSource = MySQL

  3. #3
    dssrun is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    83
    Odd, I tried this code on another computer and it worked. For some reason you need the MyCriteria at the end of the code or it won't work.

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    maybe because the first appearance of MyCriteria (inside the MySQL) there is yet no defined value.......

    you might put the Case code above the MySQL statement so that MyCriteria is defined first.....and then is placed inside MySQL

    although as I type this it doesn't seem like it should matter....but I would give it a shot....

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

Similar Threads

  1. How do I get data from a listbox?
    By cowboy in forum Programming
    Replies: 1
    Last Post: 06-15-2010, 02:28 PM
  2. Horizontal listbox - ?
    By bane in forum Forms
    Replies: 3
    Last Post: 04-20-2010, 06:48 PM
  3. Replies: 3
    Last Post: 04-14-2010, 10:00 AM
  4. Listbox question
    By uaguy3005 in forum Access
    Replies: 1
    Last Post: 03-05-2010, 08:35 AM
  5. Columns in a Listbox
    By craigalaniz in forum Access
    Replies: 3
    Last Post: 01-07-2010, 01:11 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