Results 1 to 11 of 11

Thread: option buttons connected to other stuff

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Question option buttons connected to other stuff

    I made a form in Access and am trying to set it up so that in one section you can choose from a list of past contacts, and if the contact isnt on that list, then you can enter in the name and adress of the new contact. So i made an option button group to select if the contact is on the list or if you are entering a new one, a drop down box that contains the past contacts, and some other text boxes so you can enter the new contact, but i have no idea how to make them all work together. Any help would be greatly appreciated
    Last edited by obertseph; Jun 7th, 2007 at 01:15 PM.

  2. #2
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Re: option buttons connected to other stuff

    Option buttons must be placed in a frame for them to work together...

    to tell which one the user has chosen is basically going to be a bunch of conditionals...

    if OptionButton1.checked = true then
    do something
    elseif OptionButton2.checked = true then

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Re: option buttons connected to other stuff

    ok, but what VB code would i write so that my form uses the information in the drop down box over the information in the new contact text boxes, and vice versa

  4. #4
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Re: option buttons connected to other stuff

    Not quite sure what you are trying to accomplish... Could you try explaining how these are all related again?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Re: option buttons connected to other stuff

    I have a form for people to enter new data into a database. Each new data entry contains a contact. I want to make it so they can choose a contact from a list of past contacts, or enter new information if their contact isnt in the database already. So i have it set up that there is an option button where you can choose to either pick a contact from the ones already in the database, via a dropdown box, and the other option button in my option group would be connected to an area where they can enter new contact information. Or at least thats what i hope to achieve. If you have any idea how to go about doing this, or an easier way i would greatly appreciate it.

  6. #6
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Re: option buttons connected to other stuff

    Option button could work, but I think it might be easier to just have two command buttons. One button next to the dropdown box, saying "Select contact from dropdown" and one button next to the text box, saying "Select custom contact" or something like that ...

    But if you want to stick to your option button here's some pseudocode...

    Code:
    if optDropDown.selected = True Then
       'check to make sure an item in list is selected
       'assign that value
    else 'they are entering new information
        'make sure valid entry
        'assign that value
    hope this helps

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Re: option buttons connected to other stuff

    i'm really lost when it comes to using visual basic. How can i make it so that it will take the values from my drop down list, and put them in my table as an entry.

  8. #8
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: option buttons connected to other stuff

    In Access on an Access Form:

    Create a frame control
    Rename the fram control to 'frmChoice'
    Drag n drop in two option buttons
    Change the text of the option buttons
    Set the frames default value to 1

    Code:
    select case fraChoice
     case 1
       '---- use old details from list
     case 2
       '---- code to use the new details
    end select

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Re: option buttons connected to other stuff

    ok, but what is the code to tell it to use those details from the list, thats what I cant figure out, my MS Access book doesnt talk about code that can do that.

  10. #10
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Re: option buttons connected to other stuff


  11. #11

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    29

    Re: option buttons connected to other stuff

    nevermind, i am just going to use an alternative technique
    Last edited by obertseph; Jun 12th, 2007 at 07:33 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
  •  



Click Here to Expand Forum to Full Width