I thought it was easier...
I'm trying to:
1/ Count the number of records in the Query "FR_LOAN_TYPE_1" (field "REFPMT")
2/ use that count value into a condition
3/ if countvalue > 0 then ...**do the stuff ** else ** do nothing ** end if
It must be something wrong, maybe a Dim statement, maybe my SQL string. Don't know.
Anyone has a clue?
Here is an extract of my code below
Thanks a million in advance... end of the day, I'm insanely tired.
Chris
PS: stAppFolder in a constant (Const) and is working well
I'm trying to:
1/ Count the number of records in the Query "FR_LOAN_TYPE_1" (field "REFPMT")
2/ use that count value into a condition
3/ if countvalue > 0 then ...**do the stuff ** else ** do nothing ** end if
It must be something wrong, maybe a Dim statement, maybe my SQL string. Don't know.
Anyone has a clue?
Here is an extract of my code below
Thanks a million in advance... end of the day, I'm insanely tired.
Chris
PS: stAppFolder in a constant (Const) and is working well
Code:
Dim QueryCount As Integer
Dim CountRecords As Integer
QueryCount = "SELECT Count(FR_Loan_type_1.REFPMT) AS CountOfREFPMT FROM FR_Loan_type_1 "
CountRecords = QueryCount
Dim stReportName As String
Dim stPath As String
If CountRecords > 0 Then
Dim stFileName As String 'name of the letters PDF file
stReportName = "FR_Loan_DomOK"
stPath = stAppFolder
stFileName = Format(stBatchTime, "yyyy-mm-dd-hhmmss") & "_" & stBatchNum & "_" & stReportName & ".pdf"
DoCmd.OpenReport stReportName, acPreview
DoCmd.OutputTo acOutputReport, , acFormatPDF, stPath & stFileName ', True
DoCmd.Close acReport, stReportName
Else
End If