Hi Folks
What's the simplest way of getting option groups and text boxes to send custom text to a table (rather than, respectively, numbers and 'Yes'/'No')?
Remster
Hi Folks
What's the simplest way of getting option groups and text boxes to send custom text to a table (rather than, respectively, numbers and 'Yes'/'No')?
Remster
An idea I've come up with is to have my option group unbound and to link it to a (hidden) bound text box via the following code:
Private Sub OptionGroup_AfterUpdate()I don't know if this is the best way to do it or if it might cause any problems.
If Me.OptionGroup.Value = 1 Then Me.TextBox.Value = "Rod"
If Me.OptionGroup.Value = 2 Then Me.TextBox.Value = "Jane"
If Me.OptionGroup.Value = 3 Then Me.TextBox.Value = "Freddy"
End Sub
I've cocked it up! Because the option group is unbound, making a selection in one record seems to change the selection in all records. I don't know how I didn't spot this before.
Is there any way round this or do I need to try something different entirely? One suggestion I've read is to use ...
ShowText:Choose([OptionName],"High","Low","N/A")... but I've no idea where to put this code.
Okay, I've worked it out. I needed to put the following in the form's OnCurrent event:
If Me.TextBox.Value = "Rod" Then Me.OptionGroup.Value = 1This allows the option group selection to be determined by what's already in the table, viz. nothing for a new record.
If Me.TextBox.Value = "Jane" Then Me.OptionGroup.Value = 2
If Me.TextBox.Value = "Freddy" Then Me.OptionGroup.Value = 3
If IsNull(Me.TextBox.Value) Then Me.OptionGroup.Value = 0