Results 1 to 6 of 6
  1. #1
    steveuk is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    3

    populating the page based on item chosen

    Hi guys



    Sorry im a newb here and im trying to find a solution to a issue i have with my form/database.

    ive looked on google and couldnt find information as im not sure the right wording so its taking me to different pages and things im looking for.

    basically what i am try to do is have specfic text boxes or items appear on the form depending on the combobox item you have chosen.

    For Example

    Combobox

    CAR
    CAKE RECEIPE
    CLOTHING

    if car is chosen 2 text boxes appear example car manufacturer, Car name. If Cake recipe is chosen a larger text box appears, if Clothing is chosen another combo box appears and gives you more options.

    I know its probs basic to most but i would appreciate some help if possible.

    Cheers

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Set the Visible property of the dependent controls to No. Then code in combobox AfterUpdate event, something like:

    Me.tbxCar1.Visible = Me.cbx1 = "Car"
    Me.tbxCar2.Visible = Me.cbx1 = "Car"
    Me.tbxCake.Visible = Me.cbx1 = "Cake Recipe"
    Me.cbxClothing.Visible = Me.cbx1 = "Clothing"
    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
    steveuk is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    3
    Hi June7 thanks for your swift reply

    I was using the above as Examples just to check on my form i have a table called "slattype" and the values which populate the combobox "combo18" are "Number" "Destination" Num & Destination" "Other"

    So using your above code

    Me.tbxNumber1.Visible = Me.combo18 = "Number"
    Me.tbxDestination1.Visible = Me.combo18 = "Destination"
    Me.tbxvia1.Visible = Me.combo18 = "Destination"
    Me.tbxNumber1.Visible = Me.combo18 = "Num & Destination"
    Me.tbxDestination1.Visible = Me.combo18 = "Num & Desination"
    Me.tbxvia1.Visible = Me.combo18 = "Num & Desination"
    Me.tbxOther1.Visible = Me.combo18 = "Other"

    Hopefully how i have written that, if Number is selected a box appears for just a number. Destination shows 2 boxes one for Destination and one for via, Num and Destination shows 3 boxes one for num one for dest and one for via, and Other shows one box.

    Hopefully ive grasped that right.

    Basically imagine your trying to order bus information. Number is the Service number you fill in, Destination shows a box for the location where its going with a second box for a via. Num and Des shows all 3 boxes and Other just one box for anything else.

    Cheers bud hope you get what im trying
    EDIT: didnt work so my codes slightly wrong somewhere

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    What is the sql of combo18 RowSource?
    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
    steveuk is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    3
    Here ive attached so you can see, ive gotta clean the start up page, but its the Slattype one i need the help with

    Cheers for your help mate
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    The RowSource is just referencing the table. The first field in table is the ID field which is column 1 in the combobox. The combobox is bound to column 1. That means the value of the combobox is the ID, not Slats value.

    Options:

    1. set the code to test for the ID value

    2. set code to reference Slats column of combobox: Me.combo18.Column(1)

    3. change the RowSource to pull only the Slats field.
    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: 7
    Last Post: 05-12-2014, 06:05 AM
  2. Replies: 12
    Last Post: 10-10-2013, 11:51 AM
  3. Replies: 5
    Last Post: 05-22-2013, 12:38 PM
  4. Populate combo box based on value chosen in another combo box
    By Gary Childress in forum Database Design
    Replies: 3
    Last Post: 01-12-2013, 09:44 PM
  5. Replies: 1
    Last Post: 12-24-2012, 09:36 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