My program will call a crystal report template if my sql query count * > 0 but even if my count * is 0, still program going into the If loop-- and calling crysal template which is not supposed to do so..
Dim rsUpdateROHS As ADODB.Recordset
Set CONNOW = New ADODB.Connection
Set rsUpdateROHS = New ADODB.Recordset
strSQL = "select count(*) from approvedcountries where countries in (select ShipTo from LoadPlan WHERE DJFile_Name ='" & Trim(txtDJFile) & "')"
rsUpdateROHS.Open strSQL, CONNOW, adOpenStatic, adLockOptimistic
If Not rsUpdateROHS.EOF Then ''Eventhough my select count * is 0 still program going to crytal template
CRAck.ReportFileName = App.Path & "\Report\ROHS1.rpt"
CRAck.Connect = CONNOW
CRAck.Destination = crptToWindow
'CRAck.WindowState = crptMaximized
CRAck.Action = 1
Set rsUpdateROHS = Nothing
Else ----------Should go else or end sub of count * is 0