What is wrong with this code?

A

Al

I am using this code that was posted in the forum by Phill a while back and I
am getting an error message:

Dim rs As DAO.Recordset
Dim sAddress As String, sql As String
sql = "SELECT email FROM emailReports"
Set rs = CurrentDb.OpenRecordset(sql)
Debug.Print sql
rs.MoveLast
sAddress = Join(rs.GetRows(rs.RecordCount), ";")
MsgBox sAddress
********************************
The Error message breaks on "sAddress=Join(rs.GetRows(rs.RecordCount),";")
Message:"Invalid procedure call or argument"
any idea what is wrong?
thanks
 
A

Al

Thank you very much Chris. Is there a substitute for Join that would
accomplish the same thing?
 
A

Al

Thanks, I will

Chris O'C via AccessMonster.com said:
No. You'll have to write a function that iterates through the recordset and
appends the value in the field to a string variable, followed by a semicolon.

Chris
Microsoft MVP

Thank you very much Chris. Is there a substitute for Join that would
accomplish the same thing?
Phill's code doesn't work because Join requires a one-dimensional array, but
GetRows returns a two-dimensional array.
[quoted text clipped - 6 lines]
any idea what is wrong?
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top