Hi, i have a group box with 2 radio buttons; failure and success. I need to have the text (either failure or success) saved in the access 2007 database instead of values (1 or 2). The same is also happening with the combo boxes.

Here's the code am using: (i want them to be added on a button click)

Private Sub Command55_Click()
Dim str1 As String
Dim str2 As String
Dim str3 As String

Dim str4 As String

'set combobox values
Dim str5 As String
Dim str6 As String
Dim str7 As String
Dim str8 As String

Dim cn As Connection
Dim rs As New ADODB.Recordset

str1 = Text27.Value
str2 = Diagnosis.Value
str3 = Solution.Value

str4 = Status.Value

'combo boxes
str5 = Departments.Value
str6 = Users.Value
str7 = Combo18Value
str8 = Combo20.Value

rs.Open "SELECT * FROM [Incidents]", CurrentProject.Connection, adOpenStatic, adLockOptimistic '

With rs
.AddNew
.Fields("Details") = str1
.Fields("Diagnosis") = str2
.Fields("Solution") = str3
.Fields("Status") = str4
.Fields("DeptName") = str5
.Fields("UserName") = str6
.Fields("Technician") = str7
.Fields("Problem") = str8

.Update
.Close
End With

End Sub

Any help will be appreciated.

Recommended Answers

All 3 Replies

Combo1.Text
Option1.Caption


Good Luck

thanx. However, when i use the combo.Text and Option1.Caption i can only save one combo box value. the rest are saved as numeric values for the combo boxes.

As for the radio buttons, should i declare the object capturing the data as a string? coz i did so and it brought and error.

Still a little unsure of what/why you are doing what you are doing so please explain further.

Perhaps a little more information on your table structure and exactly why you want the text versus the value.


Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.