Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Note that the GetName at the end is trying to put return just the ClientName field for the recordset rsResult. But I'm not sure how to get it to do that. This doesn't work - it tells me that the item isn't in the collection. I've also tried GetName = rsResult.ClientName, but that doesn't work either, because it's not an object.
Private Function GetName (Client) Dim strSQL as String Dim rsResult as Recordset Dim DB as Database strSQL = "SELECT TOP 1 ClientID, ClientName, FROM tblClients " & _ "WHERE (ClientID = " & Client & ");" Set DB = CurrentDb Set rsResult = DB.OpenRecordset(strSQL) GetName = rsResult([ClientName]) End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.