How can you return a value which shows if a recordset is open or closed?
Printable View
How can you return a value which shows if a recordset is open or closed?
To return a value from a recordset you must first create the recordset (Fill it with values)
off the top I think it's like this in dao
Dim sql as string
sql = "Select aField from yourTable"
data1.recordsource = sql
data1.refresh
to get the first record
data1.recordset.movefirst
myString = Data1.Recordset!yourfield
I don't think we were on the same line there, otherwise I am confused. I want to know if the recordset is open, not return a record. Here's my code:
________________________________________________
Private Sub cboBankName_click()
***Want to know if the recordset is already open here***
***If the recordset is open THEN
rst.close
end if
gstrHold = cboBankName.Text
rst.Open "SELECT Banks.*, BankFees.* " & _
"FROM BankFees INNER JOIN Banks ON BankFees.BankName = Banks.BankName " & _
"WHERE FeeEndDate is NULL " & _
"AND Banks.BankName = '" & gstrHold & "' ;", cnn, adOpenStatic, adLockOptimistic
'Predefined subroutine
FillBoxes
End Sub
Check the "State" of the recordset.
If rsValidate.State = adStateOpen Then
' do whatever
End If
Thanks...Worked great.
smh
Damn. Missed one of your threads - no more lunch for me...
Cheers,
P.
You deserve lobster for dinner after yesterday...
smh