Ok, I think this should do it. I was just going by your examples.
VB Code:
Private Sub CommandButton3_Click() Dim con As ADODB.Connection Set con = New ADODB.Connection con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb" If Not TypeName(rst) = "Nothing" Then 'something If rst.State = adStateOpen Then 'open rst.Close Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", False, "C:\exercise.mdb") Else 'closed Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", False, "C:\exercise.mdb") End If Else 'nothing Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", False, "C:\exercise.mdb") End If TextBox3.Text = rst.Fields("Qty") End Sub





Reply With Quote