0 Replies - 845 Views - Last Post: 15 June 2014 - 08:48 AM Rate Topic: -----

#1 max2612  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-June 14

Selected Option Box Won't Save in Database

Posted 15 June 2014 - 08:48 AM

Hello... I'm not new to VB6 but I left vb for many years and my memory is very fuzzy right now.

Here's my problem. I created a questionnaire like system. So everything is ok, no error, connected my codes to the database (connection string and recordset)... But, when I start the system and check/tick the option, the selected option won't save to the database... I've tried with adodc1.recordset.addnew and adodc1.recordset.save(except for this one which give me an error of "Run-time error '-2147286781(80030103)' Can't save), and still no changes to my database. Here's my code

Option Explicit
Dim message As String
Dim message2 As String

Private Sub office_Click()
    If office.Value = 1 Then
        fair.Value = 0
        counter.Value = 0
    End If
End Sub

Private Sub fair_Click()
    If fair.Value = 1 Then
        office.Value = 0
        counter.Value = 0
    End If
End Sub

Private Sub counter_Click()
    If counter.Value = 1 Then
        office.Value = 0
        fair.Value = 0
    End If
End Sub

Private Sub yes_Click()
    If yes.Value = 1 Then
        no.Value = 0
    End If
End Sub

Private Sub no_Click()
    If no.Value = 1 Then
        yes.Value = 0
    End If
End Sub

Private Sub fin_Click()
       
    If ((office.Value = 1 Or fair.Value = 1 Or counter.Value = 1) And (no.Value = 1 Or yes.Value = 1)) Then
        message = MsgBox("Thank you for your feedback", vbOKOnly + vbInformation, "Thank you")
        office = 0
        fair = 0
        counter = 0
        yes = 0
        no = 0
        
        Adodc1.Recordset.AddNew
        End
    Else
        message2 = MsgBox("Please choose your option.", vbOKOnly + vbExclamation, "Try again")
    End If
    
    

    End Sub




I put the database field as yes/no for data type and true/false for format.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1