I need to find a way to pass the value of my vb6 option button to an access database field. Let me describe it here:
I have this field called Gender in my database, which is a Text data type. It should hold either "Male" or "Female" value. This "Male" or "Female" value shall be coming from my vb6 form using option buttons. Option1 holds the Male value and Option2 holds the Female value. When the user clicks either option button, it should pass its value to the Gender field of my database.
Here's my code so far:
Private Sub Command1_Click() Dim myRS As Recordset If Option1.Value = True Then myRS.Fields!Gender = "Male" ElseIf Option2.Value = True Then myRS.Fields!Gender = "Female" End If Adodc1.Recordset.Update End Sub
- When I run the code above, it generates error that says Run-time error 91: Object variable or With block variable not set
- I'm using ADO control to connect my vb6 form to access.
I have been going around in circle for quite some time now, but it seems I can't find the exact way to solve it.
I'd really appreciate any help I could get.
Thanks a lot.