Solved HTML with Bullets (1 Viewer)

pooldead

Registered User.
Local time
Yesterday, 22:59
Joined
Sep 4, 2019
Messages
136
I have a function to create emails from my database, which works fine. The problem I'm running into is trying to insert data from a recordset into the HTML code as bullet points. Here is what I have so far:
Code:
Set rs1 = CurrentDb.OpenRecordset("SELECT DISTINCT Manager_ID FROM TableA WHERE ((Manager_ID Is Not Null) AND ([APPROVE/DENY] Is Null))")
    users = rs1.Fields("Manager_ID") & "<br>" & users
    
body = "<p>[EMAIL BODY TEXT]</p>" & _
       "<ul><li><strong>" & users & "</strong></li><ul>"
This does work, to a point. It will insert the first record in rs1, but doesn't loop in order to grab the other records as well.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:59
Joined
Oct 29, 2018
Messages
21,358
Are there any loop construct in your code? For example, I tend to use something like:

Code:
With rs
    Do While Not .EOF
        'do stuff
        .MoveNext
    Loop
End With
 

pooldead

Registered User.
Local time
Yesterday, 22:59
Joined
Sep 4, 2019
Messages
136
I usually have something like that too. But this time I do not. Only because I want to drop in each "Manager_ID" in the same email. I've used loops before when creating an email for each account, but this time I'm aiming for one email only.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:59
Joined
Oct 29, 2018
Messages
21,358
I usually have something like that too. But this time I do not. Only because I want to drop in each "Manager_ID" in the same email. I've used loops before when creating an email for each account, but this time I'm aiming for one email only.
Well, I thought you said you want to add each record as bullet points? If so, that's where I think you can use a loop. You may not need a loop to send only one email, but sounds like you may need a loop to get all the records into one email.
 

pooldead

Registered User.
Local time
Yesterday, 22:59
Joined
Sep 4, 2019
Messages
136
It took me a minute to think through that, but I get what you're saying now. I'll try the loop and see what happens.
 

pooldead

Registered User.
Local time
Yesterday, 22:59
Joined
Sep 4, 2019
Messages
136
Well, I thought you said you want to add each record as bullet points? If so, that's where I think you can use a loop. You may not need a loop to send only one email, but sounds like you may need a loop to get all the records into one email.
Thank you for the help, that did the trick! Sorry, I was confused at first. I appreciate your help!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:59
Joined
Oct 29, 2018
Messages
21,358
It took me a minute to think through that, but I get what you're saying now. I'll try the loop and see what happens.
Hi. Glad to hear it made sense. Inside the loop where I had 'do stuff, that's where you tell the code to do whatever it is you want to do with the records. In some cases, I guess you tell it to send individual emails. In this case, I think you want to create a bullet for each record. Correct?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:59
Joined
Oct 29, 2018
Messages
21,358
Thank you for the help, that did the trick! Sorry, I was confused at first. I appreciate your help!
Oops, our posts have crossed in the wires. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom