Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2013
    Posts
    7

    Post Unanswered: Form Probs: Radio Button, Dropdown.

    Hi,

    This might goes a very long post please excuse me

    I work with Form:Add_Memo that should be store data from what users input from text fields, dropdown and radio button.

    1)
    I have a problem getting the value on radio button which is made from 'Option Group' from the toolbox I see that the Option value from those buttons contains 1,2,3, ... how can I made an update from the value selected.

    2)
    I got 2 Buttons here 'Add Memo' and 'Reset' which should be add all data to table 'Memo' and Reset any inputs from those text fields,radios and dropdowns.
    My code is:
    Private Sub ResetField_Click()
    Forms!Add_Memo!EmailSentDate = ""
    Forms!Add_Memo!DueDate = ""
    Forms!Add_Memo!SubjectText = ""
    Forms!Add_Memo!EmailFromText = ""
    End Sub


    but it works only on Text fields only, dropdowns and radio button still keep data from previous record. I also put these codes to 'Add' button to reset all fields after added informations but it works like my 'Reset' button here. Also, I have looked on for something like 'Default Values' but found none on both.

    3)
    I try to make an IF condition to check whether the user fill all the required fields such as EmailSentDate, DueDate, Subject, are not null or not left blank. I try these:
    If
    Forms!Add_Memo!SubjectText = "" Or
    Forms!Add_Memo!DueDate = "" Or
    Forms!Add_Memo!EmailSentDate= "" Then
    MsgBox "Please Input Data"
    End If
    I have try Forms!Add_Memo!DueDate IsNull and Forms!Add_Memo!DueDate = " " but those also not working :/ maybe I missed something.


    I am a beginner to VBA code and more kinda familiar with Design View: Query and I think of 'DoCmd' fn but same problem, I cannot link what I want such as Radio button values.

    Sorry for the long post and Thanks in advance.
    Blue,

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You need to consider the value of the option group, not the value of the controls inside it.
    Have a nice day!

  3. #3
    Join Date
    Nov 2013
    Posts
    7
    Is that the Radio's Name?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Have a nice day!

  5. #5
    Join Date
    Nov 2013
    Posts
    7
    Well, I know that option group contains their option values, but thing is, I dont know how to reach the values I am prepared to make something like iif(option values = 1,Opt1,Opt2) or some kind since there are only 2 options.

    Thanks for the Ref. anyways. If you have the codes, queries solution that can do the trick I would be appreciated.

    Blue

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Let's imagine that you have a form with an OptionGroup control named OptionGroup_0. In this OptionGroup control you have two Option Buttons:
    1. Name = Option_1, Option value = 1
    2. Name = Option_2, Option value = 2

    To retrieve the value of the selected option button in the option group, you use:
    Code:
    SelectedValue = Me.OptionGroup_0.Value
    To change the selected option, you use:
    Code:
    Me.OptionGroup_0.Value = NewValue
    You never deal directly with the option buttons controls, only with their container (the option group control).
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •