G
Guest
I am trying to use a query's results (a username) to look up the full name of
the individual from the GAL. When i hardcode the username in (ex. below
AB30C), the function will resolve and return the correct username. However,
when i try to run the openrecordset command, i get the runtime 3061 error
stating "too few parameters. Expected 1".
I tried putting my query code directly in instead of the name, but i still
get the same error.
Any help is greatly appreciated.
The code i am running is below:
Function sbSendMessage(userAlias As String)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim objAlias As String
Dim data As DAO.Database
Dim names As DAO.Recordset
Set data = CurrentDb
Set names = data.OpenRecordset("QuerybyMailbox", dbOpenSnapshot)
'Debug.Print names.Updatable
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("AB30C")
objOutlookRecip.Type = olTo
objAlias = objOutlookRecip.Resolve
userAlias = objOutlookRecip
End With
End Function
the individual from the GAL. When i hardcode the username in (ex. below
AB30C), the function will resolve and return the correct username. However,
when i try to run the openrecordset command, i get the runtime 3061 error
stating "too few parameters. Expected 1".
I tried putting my query code directly in instead of the name, but i still
get the same error.
Any help is greatly appreciated.
The code i am running is below:
Function sbSendMessage(userAlias As String)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim objAlias As String
Dim data As DAO.Database
Dim names As DAO.Recordset
Set data = CurrentDb
Set names = data.OpenRecordset("QuerybyMailbox", dbOpenSnapshot)
'Debug.Print names.Updatable
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("AB30C")
objOutlookRecip.Type = olTo
objAlias = objOutlookRecip.Resolve
userAlias = objOutlookRecip
End With
End Function