Results 1 to 7 of 7
  1. #1
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110

    Making Buttons Appear based on Combo box item selections

    Hi

    I have a database where I have a table with sime fields that are fields for a UK Storage Cert, A UK Distribution Cert, A UK Vat, and an International Storage Cert and an Internationa Distribution Cert.

    I have a form where the user enters the customer address, and the enter the company address.

    I would like it that if the country = untied kingdom, then the buttons for UK Storage Cert, UK Distribution Cert A UK Vat cert will be visible, and if the enter another country value then International Storage Cert and International Distribution Cery are displaed.

    There are other variations but these should be enough to get me started.

    How do i make specific buttons visible based on the value of a combo box saved in the footer?



    Regards

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Something like:

    Me.UKbuttonname.Visible = Me!country = "United Kingdom"

    Me.NotUKbuttonname.Visible = Me!country <> "United Kingdom"

    Real trick is figuring out what event(s) to put code into.

    Also, this setting will apply to all records.
    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
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    you can also use the tag property for this.
    Assign the value UK to the tag property of all the UK buttons and INT to the other buttons.
    Then use code similar to that in my SetControls demo app to update the button visibility in one line of code.
    The code should be added to the after update event of the combo.

    See http://www.mendipdatasystems.co.uk/s...ols/4594398114 for the demo app.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    If there are a lot of "other variations" you might want to use a Select Case block in the combo AfterUpdate event.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110
    I decided to go with the below for which I had to remember to specify the array of my combo box presently giving me the data.

    Private Sub Form_Load()
    If Me.Country_Lookup.Column(1) = "United Kingdom" Then
    Me.Wowgrbtn.Visible = True
    Else
    Me.Wowgrbtn.Visible = False
    End If
    End Sub

    Glad it worked, thanks for all your advice everyone.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Might interest you to know that this sort of thing will usually work too (just for future reference)

    Private Sub Form_Load()
    Me.Wowgrbtn.Visible = Me.Country_Lookup.Column(1) = "United Kingdom"
    End Sub

    which is basically what June7 suggested. BTW, if your form displays only single records and you're going to navigate from record to record, your code isn't going to do what you need.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110
    Hi Micron

    The way this database is being designed is that it is a process flow database. The user will only be able to work on one record at a time with this setup. Basically it leads the user through some complex legal checks that have to be completed. So the user is asked the company country of operation, then determines which buttons are displayed, which in turn will determine sub buttons, then the user fills out the relevant sections. But they can't jump from process to process as they have a report at the end that needs to be PDF'd and sent to our Gov for approval.

    I have a continuous form which lists types of companies with control buttons to open the database up further for a much bigger edit.

    However I have kept notes of both versions for future reference.

    Thank you.

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

Similar Threads

  1. Replies: 3
    Last Post: 04-13-2016, 07:18 AM
  2. Replies: 9
    Last Post: 07-31-2012, 11:30 AM
  3. Replies: 2
    Last Post: 06-19-2012, 08:30 AM
  4. Replies: 3
    Last Post: 04-09-2012, 10:16 AM
  5. Replies: 1
    Last Post: 05-25-2011, 08:37 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