Results 1 to 9 of 9
  1. #1
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6

    Form help

    I have a form which has a list box populated by a table.



    Next I want some text boxes to appear when an item in the list box is clicked... how do I achieve this?

    I can't even seem to set those text boxes as hidden by default!

    These text boxes must contain information that is relevant to the item clicked in the list.

    Any help greatly apreciated - I'm a complete Access newbie.

    Thanks

  2. #2
    trb5016 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    So if on your form you have the following controls: Listbox1, Textbox1, Textbox2, Textbox3.

    You can set the Visible property of the textboxes to No and that should make them invisible when the form loads.

    Now in the "After Update" Property of the List Box you would put code like this:

    Code:
    [Textbox1].Visible = False
    [Textbox2].Visible = False
    [Textbox3].Visible = False
    
    Select Case 
    [Listbox1].Value
    
       Case "Choice 1"
          [Textbox1].Visible = True
    
       Case "Choice 2"
          [Textbox2].Visible = True
    
       Case "Choice 3"
          [Textbox3].Visible = True
    
    End Select
    This should cover it. Note there are more efficient ways of coding this (depending on how many values you have) but they're a little more complicated.

  3. #3
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6
    Hi there,
    Thanks very much for your prompt help... however I will need a more efficient and flexible solution, as the listbox's content will change every week or so.

    Thanks

  4. #4
    trb5016 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    Can you explain more about your data structure and what needs to show as each value is chosen in the list box?

  5. #5
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6
    I literally only started using Access today for the first time so I don't have much!

    I have one table, currently only with 5 fields - ID, Name (the values of this field are displayed in the listbox), Date, Time and Location.

    Upon clicking a Name in the listbox, I'd like 4 textboxes to appear, 1 for each field except ID.

  6. #6
    trb5016 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    First off one thing I'd like to warn you about. Name, Date and Time are all reserved words in access, you might want to change them by adding a prefix or something. Using reserved words can have some strange consequences later on.
    http://support.microsoft.com/kb/286335



    (Not to try and sway you from your user interface design ideas) but could you just have a form with all the fields (Name, Date, Time and Location) and use the normal form navigation buttons to jump between records?

    If you're set on this method of doing it let me know and we can try and figure something out (it'll be a lot more complicated, but if that's what you need, that's what you need)

  7. #7
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6
    Ah the fields do actually have a prefix!

    Is this the form navigation you mean?


    If so, I'm afraid that won't do.

    However I don't want to waste your time! I'll do some more surfing/tinkering and I'll post back here.

  8. #8
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6
    --------------------------------
    Last edited by Vertaxe; 08-09-2010 at 09:24 AM.

  9. #9
    Vertaxe is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    6
    I'm going to have the same textbox appear no matter which selection the user makes.

    However, how can I change that textbox's value to a different value from the same row in the table?

    I've been playing around trying to use queries, SQL and various things to achieve what I imagine is a very easy thing!!

    i.e. user selects something from List1 (which is populated by the eventName field in a table), then Text1 changes to eventLocation located on the same row.

    Again, any help greatly apreciated! I'm getting there slowly.

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

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