In the addRecord sub you have to check which option button is selected and then save the value.In reality, it would be much better to save the option button index instead of the caption. If you save the index you wouldn't need a Case statement to select the saved option button when you call FillFields in your Entry form. All you would need to do isCode:Private Sub addRecord() Dim cn As ADODB.Connection Dim sql As String Dim i As Integer For i = 0 To Option1.UBound If Option1(i).Value Then Exit For End If Next i sql = "Insert Into Table1(TrayPosition,Name,[Date],Spice,[Plant Type]) " & _ "Values([TRAYPOSITION],'[NAME]','[DATE]','[SPICE]','[PLANTTYPE]')" sql = Replace(sql, "[TRAYPOSITION]", intBtnIndex) sql = Replace(sql, "[NAME]", Text1.Text) 'Saves the Seed name to the database sql = Replace(sql, "[DATE]", Text3.Text) 'The date the seed was planted sql = Replace(sql, "[SPICE]", Option1(i).Caption) 'The how hot the seed is sql = Replace(sql, "[PLANTTYPE]", Combo1.Text) 'The type of seed (example: vegtable) On Error GoTo HandleSaveErrors Set cn = GetConnection cn.Execute sql Set cn = Nothing blnAdded = True Exit Sub HandleSaveErrors: strMessage = "Record could not be saved. " & vbCrLf & Err.Description MsgBox strMessage, vbExclamation, "Database Error" End SubIf you run with this approach you need to change the Spice column in the table from Text datatype to Number and adjust the insert query so Spice is not wrapped in single quotes.Code:Option2(rs!Spice).Value = True




Reply With Quote