Tom Crowfoot
asked on
Iff Statement based on record count
Dear Experts
I am building a news letter database which will send out various stories which have been categorized. In the body of the email I have a series of RST recordsets to insert the story headlines by category.
Each category is defined by its own query & the RST loops get compiled at the end of the code. This all works fine, but what I would like to do is this ...
If a category contains no story then I want that part of the string to be null. So in the example below I have inserted where I would like the if statement to run
Can anybody help?
I am building a news letter database which will send out various stories which have been categorized. In the body of the email I have a series of RST recordsets to insert the story headlines by category.
Each category is defined by its own query & the RST loops get compiled at the end of the code. This all works fine, but what I would like to do is this ...
If a category contains no story then I want that part of the string to be null. So in the example below I have inserted where I would like the if statement to run
' .....................................................................................................
' RST Insurance
Dim rstInsurance As Recordset
Set rstInsurance = CurrentDb.OpenRecordset("Newsletter FS Sub Insurance")
Do While Not rstInsurance.EOF
EmailBodyHeadlinesInsurance = EmailBodyHeadlinesInsurance & "<li>" & rstInsurance!title & "</li>"
rstInsurance.MoveNext
Loop
rstInsurance.Close
' ... insert here something that states if record set is empty then EmailBodyHeadlinesInsurance = "" else EmailBodyHeadlinesInsurance = "INSURANCE <br>" & EmailBodyHeadlinesInsurance
Can anybody help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER