Hi all,
I am in the process of developing a small Access application. i have the table locally in Access and I am using the following code to get the recordcount ( or to check if any record exists), but when i check for rst.eof condition, it is always true..but when i actually run the query i see, many rows returned, i m not clear about how to specify the connection parameter with the recordset, as i m using the tables locally, but i think something is wrong with the ADODB connection???
[code starts here]
Private Sub Process_Click()
Dim rcst As New ADODB.Recordset
Dim Con As New ADODB.Connectio n
Dim rst As New ADODB.Recordset
Set Con = CurrentProject. Connection
If Frame160 = 1 Then
query1 = "select * from Table a where DMNum LIKE '" & Textboxentry& "*'"
rst.Open query1, Con, adOpenDynamic, adLockOptimisti c
If rst.EOF = True Then
MsgBox " No Records Available for this search"
Textboxentry.Te xt = ""
rst.Close
Call Form_Load
Exit Sub
Else
query1 = "select * from Table a where DMNum LIKE '" & Textboxentry& "*'"
Me.Mysubform.Fo rm.RecordSource = query1
Form_Myform.Tex tboxentry= Clear
Form_Myform.Tex tboxentry.SetFo cus
Textboxentry= ""
rst.Close
End If
ElseIf Frame160 = 2 Then
............... .....
............... .
End If
End Sub
[code ends here]
Is there anyother way that i can check for recordcount for the Query1?
Any help is highly appreciated.
Thanks so much in advance....
I am in the process of developing a small Access application. i have the table locally in Access and I am using the following code to get the recordcount ( or to check if any record exists), but when i check for rst.eof condition, it is always true..but when i actually run the query i see, many rows returned, i m not clear about how to specify the connection parameter with the recordset, as i m using the tables locally, but i think something is wrong with the ADODB connection???
[code starts here]
Private Sub Process_Click()
Dim rcst As New ADODB.Recordset
Dim Con As New ADODB.Connectio n
Dim rst As New ADODB.Recordset
Set Con = CurrentProject. Connection
If Frame160 = 1 Then
query1 = "select * from Table a where DMNum LIKE '" & Textboxentry& "*'"
rst.Open query1, Con, adOpenDynamic, adLockOptimisti c
If rst.EOF = True Then
MsgBox " No Records Available for this search"
Textboxentry.Te xt = ""
rst.Close
Call Form_Load
Exit Sub
Else
query1 = "select * from Table a where DMNum LIKE '" & Textboxentry& "*'"
Me.Mysubform.Fo rm.RecordSource = query1
Form_Myform.Tex tboxentry= Clear
Form_Myform.Tex tboxentry.SetFo cus
Textboxentry= ""
rst.Close
End If
ElseIf Frame160 = 2 Then
............... .....
............... .
End If
End Sub
[code ends here]
Is there anyother way that i can check for recordcount for the Query1?
Any help is highly appreciated.
Thanks so much in advance....
Comment