Using Outlook VBA to open custom form

L

Leiarose

I'm sure this issue has been visited before but I am having troubl
finding help about it. I have a custom form pulling in access data, bu
a reference number needs to be passed to the custom form to populate th
fields. I created a userform in outlook vba with a combobox to selec
the ref number also populated from access. When the code gets to ite
display I receive a "dialog box is open error. I don't know if my re
number is being passed either. Help. Here is some of the code. :)

Sub DisplayForm()

Dim rst1
Dim EvArray()
Dim EventsDB
Dim DAO
Dim Page
Dim counter
Dim n
Dim reqno
Dim Qry1
Dim nms

Set myFolder = Session.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items.Add("IPM.Note.Apps")
Set nms = Application.GetNamespace("MAPI").CurrentUser
On Error Resume Next
Set DAO = Application.CreateObject("DAO.DBEngine.36")
Set DAO = DAO.Workspaces(0)
Set EventsDB = DAO.OpenDatabase("C:\Documents an
Settings\ISDUNLAP.DOT\Desktop\resume.mdb")
If Err.Number <> 0 Then
Set DAO = Application.CreateObject("DAO.DBEngine.35")
End If

Qry1 = "SELECT * FROM qrytotboxs" '
Set rst1 = EventsDB.OpenRecordset(Qry1) 'gets req#

rst1.MoveLast
Set Lst1 = UserForm1.ComboBox1
counter = 0
n = rst1.RecordCount - 1
rst1.MoveFirst
ReDim EvArray(n, 1)
Do Until rst1.EOF
EvArray(counter, 0) = rst1.Fields(0)
rst1.MoveNext
counter = counter + 1
Loop
Lst1.List() = EvArray
Load UserForm1
UserForm1.Show
End Sub

Sub ComboBox1_Change()
Set objFolder = Session.GetDefaultFolder(olFolderInbox)
Set objItem = objFolder.Items.Add("IPM.Note.Apps")
reqno = UserForm1.ComboBox1.Value
myItem.Subject = reqno
myItem.Display 'I get dialog box error here
End Su
 

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