I have the following function:
Public Function pubCurrentAgency() As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim CompanyName As String
Dim TradingName As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from tblAgency where Active = True")
pubCurrentAgency = rst!CompanyName
End Function
I want to use this function in a Msgbox like this:
MsgBox "No Agency Folder has been specified for " & pubCurrentAgency & "."
When I compile the database Access highlights "pubCurrentAgency" in the Msgbox and I get an error message "Ambiguous Name Detected"
What am I doing wrong?
Public Function pubCurrentAgency() As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim CompanyName As String
Dim TradingName As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from tblAgency where Active = True")
pubCurrentAgency = rst!CompanyName
End Function
I want to use this function in a Msgbox like this:
MsgBox "No Agency Folder has been specified for " & pubCurrentAgency & "."
When I compile the database Access highlights "pubCurrentAgency" in the Msgbox and I get an error message "Ambiguous Name Detected"
What am I doing wrong?