I
I H Naqvi
I have One Control form and One Data Form. I get certain inputs on control
from and Want to Open Data Form based on Them.
Before Openning, I want to count the records of that query with a run time
WHERE Clause to see that query will return any record
or not. If query return no record the msgbox should display telling "no
matching records are
found" otherwise data form will display quered records. I am a student of
Oracle and dont know much about MS Acccess. I have used following
code but it returns an error of Type Mismatch ( Error 13 ). I also tried to
execute .OpenRecordSet
Command from Setting a QueryDef But it also results same error. Pl correct
this code or tell me Do we have any command
evivalent of QueryHit of Oracle.
The Code is
Dim dbsSecurity As Database
Dim rstCriteria As Recordset
Dim CountR As Long
Dim stDocName As String
Dim stLinkCriteria As String
Set dbsSecurity = CurrentDb
Set rstCriteria = dbsSecurity.OpenRecordset("Criteria")
'Where Criteria is a valid Query Name
CountR = rstCriteria.RecordCount
if CountR=0 then
MsgBox ("Selected Criteria Returns No Record")
Exit Sub
Else
stDocName = "Build Criteria1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End if
rstCriteria.Close
dbsSecurity.Close
from and Want to Open Data Form based on Them.
Before Openning, I want to count the records of that query with a run time
WHERE Clause to see that query will return any record
or not. If query return no record the msgbox should display telling "no
matching records are
found" otherwise data form will display quered records. I am a student of
Oracle and dont know much about MS Acccess. I have used following
code but it returns an error of Type Mismatch ( Error 13 ). I also tried to
execute .OpenRecordSet
Command from Setting a QueryDef But it also results same error. Pl correct
this code or tell me Do we have any command
evivalent of QueryHit of Oracle.
The Code is
Dim dbsSecurity As Database
Dim rstCriteria As Recordset
Dim CountR As Long
Dim stDocName As String
Dim stLinkCriteria As String
Set dbsSecurity = CurrentDb
Set rstCriteria = dbsSecurity.OpenRecordset("Criteria")
'Where Criteria is a valid Query Name
CountR = rstCriteria.RecordCount
if CountR=0 then
MsgBox ("Selected Criteria Returns No Record")
Exit Sub
Else
stDocName = "Build Criteria1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End if
rstCriteria.Close
dbsSecurity.Close