I am attempting to fetch data from a table EmailList and place it into an array, which will be passed to the "To:" field of an outlook email message (the script for the email is made). I plan on using the Join() function to combine the array into a string as so: Join(varEmailList, "; ").
My Code:
Private Sub Propose_Click()
Dim MyDB As DAO.Database
Dim rstEmails As DAO.Recordset
Dim varEmails() As Variant
Dim intRowNum As Integer
Dim intColNum As Integer
Set MyDB = CurrentDb
Set rstEmails = MyDB.OpenRecordset("select email from EmailList", dbOpenSnapshot)
'Let's retrieve ALL Rows in the rstEmails Recordset
varEmails = rstEmails.GetRows()
MsgBox ("Number of Fields Retrieved: " & UBound(varEmails, 1) + 1)
rstEmails.Close
Set rstEmails = Nothing
End Sub
The issue I am having is that only one record is being found by the code, where there should be at least 10 at a time.
rstEmails.RecordCountfrom thevarEmailscall.