what about if i dont have a record on my table and i will add a new one i always got an error of either .eof or .bof is true, or current recordset are closed.opretaions requires a recordVB Code:
Private Sub cmdSave_Click() If CheckTextBox(txtDepTitle, "Invalid 'DEPARTMENT Title' value. This field is required, please enter a value.") = False Then StartTxt txtDepTitle Else With tbDepartment .MoveFirst .Find "DepartmentName = '" & txtDepTitle & "'" If .EOF = True Then .AddNew .Fields(0) = txtDepTitle .Update .Requery End If End With ans = MsgBox("New Deparment entry successfully saved to the record." & vbNewLine & "Do You Want To Add Another Record?", vbYesNo, "Titus School Of Multimedia") If ans = vbNo Then Unload Me End If End If End Sub Private Sub Form_Load() tbDepartment.Open "Select * from tbdepartment where 1<>1", cn, adOpenDynamic, adLockOptimistic End Sub




Reply With Quote