oneidalake
New member
- Local time
- Today, 10:07
- Joined
- Mar 9, 2017
- Messages
- 10
I have a form with 40 radio buttons and 40 date fields
The radio buttons are named Select1,Select2, Select3...
The date fields are named d1,d2,d3...
Each radio button number corresponds to the date field number.
I'm trying to send the value of the date field to a single field called "SelectedDate" when the corresponding radio button is on.
Basically, when I enable Select1, I want to send the value of D1 to SelectedDate. I know if I type in the exact names of the fields it will work, but I'm trying to learn how to do this without having to modify each sub.
Something like this, but of course this only sends the name of the date field to the SelectedDate field.
Note: I'm using 'mid' to extract the number from the radio button and then put a 'd' in front of it to refer to the date field.
ClickedDate = "[d" & Mid(Me.ActiveControl.Name, 7, 2) & "]"
If Me.ActiveControl = True Then
SelectedDate = ClickedDate
Else
SelectedDate = Null
End If
I apologize if this sounds confusing, but I wasn't sure how to describe this.
Thank you!
The radio buttons are named Select1,Select2, Select3...
The date fields are named d1,d2,d3...
Each radio button number corresponds to the date field number.
I'm trying to send the value of the date field to a single field called "SelectedDate" when the corresponding radio button is on.
Basically, when I enable Select1, I want to send the value of D1 to SelectedDate. I know if I type in the exact names of the fields it will work, but I'm trying to learn how to do this without having to modify each sub.
Something like this, but of course this only sends the name of the date field to the SelectedDate field.
Note: I'm using 'mid' to extract the number from the radio button and then put a 'd' in front of it to refer to the date field.
ClickedDate = "[d" & Mid(Me.ActiveControl.Name, 7, 2) & "]"
If Me.ActiveControl = True Then
SelectedDate = ClickedDate
Else
SelectedDate = Null
End If
I apologize if this sounds confusing, but I wasn't sure how to describe this.
Thank you!