So i did it like this:
Code:
Public showme As Integer 'Declare public string
Sub CheckDB()
Dim db As Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim truenot As String
'showme = 0 ' default value
Set db = CurrentDb
Set rst = db.OpenRecordset("select * From [H243-L] where ver1_2="" ")
If rst.RecordCount <> 0 Then
'Open Report1
showme = 1
Else
'Open Report2
showme = 0
End If
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
and in my button form code i use like this:
Code:
If showme = 1 Then
MsgBox "Result is: " & showme
'DoCmd.OpenReport "Print_W177-L", acViewPreview
'If result = 1 Then
'DoCmd.PrintOut , , , , Text19.Value, False
'End If
Else
MsgBox "Result is: " & showme
End If
But it returns showme = 0 always