Public Con As New ADODB.Connection
Dim TSQL As String
Public RTMP As New ADODB.Recordset
Private Sub Command1_Click()
TSQL = "delete from data where inv ='" & Form29.Text1.Text & "'"
Set RTMP = Get_Special_Record_Set(TSQL)
If RTMP.EOF = True Then
MsgBox ("INVOICE NOT FOUND")
Else
MsgBox ("INVOICE DELETED")
Form30.Visible = False
End If
End Sub
Private Sub Form_Load()
Function Open_Connection()
If Con.State = 1 Then
Con.Close
End If
With Con
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\database\DB.mdb;Persist Security Info=False"
.ConnectionTimeout = 30
.CursorLocation = adUseClient
.Open
End With
End Function
Function Get_Special_Record_Set(ByRef Shakti As String) As ADODB.Recordset
Dim Shakti As String
If RTMP.State = 1 Then
RTMP.Close
End If
RTMP.Open Shakti, Con, adOpenDynamic, adLockOptimistic
Set Get_Special_Record_Set = RTMP
End Function