I work with Form:Add_Memo that should be store data from what users input from text fields, dropdown and radio button.
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.
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 = ""
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.
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:
Forms!Add_Memo!SubjectText = "" Or
Forms!Add_Memo!DueDate = "" Or
Forms!Add_Memo!EmailSentDate= "" Then
MsgBox "Please Input Data"
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.
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.
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:
SelectedValue = Me.OptionGroup_0.Value
To change the selected option, you use:
Me.OptionGroup_0.Value = NewValue
You never deal directly with the option buttons controls, only with their container (the option group control).