VBA Compile Error: User-Defined Type Not Defined-Please Help : )

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by anova » Thu, 06 Nov 2008 08:56:10


riends,

I wrote a VBA script that reads values from the EPM Reporting
Database, presents a form, and then creates a "shell project" based on
what the user selects (to save time for developers).

I store this in an MPP file called SDLC.mpp which works perfectly each
time I run it within the open MPP. However, once I copy the module to
Enterprise Global (for other users to access), I receive this error
that seems to pertain to the database connection. "Dim Conn As New
ADODB.Connection" is highlighted in black and "Sub SDLC()" is
highlighted in yellow.

Any ideas? I'm very new to this, and was very excited to see it work
very well UNTIL I copied to Enterprise Global.

See Below.

Also, I assume all I have to do is copy the FORM used (along with its
code) via the MS Visual Basic editor to the checked-out enterprise
global from the MPP file (see very bottom)?

Thanks,
Andy Novak
UNT

******

Option Explicit

Sub SDLC()
'You need a reference to Microsoft ActiveX Data Objects 2.5
'or greater to let this code run
Dim Conn As New ADODB.Connection
Dim rs As ADODB.Recordset
'Create Connection to the .mdb file
Set Conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Conn.ConnectionString = "Provider=sqloledb;" _
& "Data Source=#####;" _
& "Initial Catalog=ProjectServer_Reporting;" _
& "Integrated Security=SSPI;"
Conn.Open

'Open Recordset with all Performers in
rs.Open "Select CAST(MemberFullValue as varchar(255)) AS
MemberValue,MemberDescription FROM MSPLT_Performer_UserView WHERE
(MemberValue <> '') ORDER BY MemberValue", Conn

Dim rs2 As ADODB.Recordset
'Create Connection to the .mdb file
Set rs2 = New ADODB.Recordset

'Open Recordset with all Service Areas in
rs2.Open "Select MemberValue FROM [MSPLT_Service Area_UserView]
WHERE (MemberValue <> '') ORDER BY MemberValue", Conn

Dim rs3 As ADODB.Recordset
'Create Connection to the .mdb file
Set rs3 = New ADODB.Recordset

'Open Recordset with all Institutions in
rs3.Open "Select MemberValue FROM [MSPLT_Institution_UserView]
WHERE (MemberValue <> '') ORDER BY MemberValue", Conn

Dim rs4 As ADODB.Recordset
'Create Connection to the .mdb file
Set rs4 = New ADODB.Recordset

'Open Recordset with all Institutions in
rs4.Open "Select MemberValue FROM [MSPLT_Project
Classification_UserView] WHERE (MemberValue <> '') ORDER BY
MemberValue", Conn

'Initialize Combo Boxes
Dim i As Integer
rs.MoveFirst
i = 0
With NewProject.TeamComboBox
.Clear
Do
.AddItem
.List(i, 0) = rs!MemberDescription
'.List(i, 1) = rs!MemberFullValue
.List(i, 1) = rs!MemberValue
i = i + 1
rs.MoveNext
Loop Until rs.EOF
End With

Do Until rs2.EOF
'Debug.Print rs2!MemberValue
NewProject.SvcAreaComboBox.AddItem (rs2!MemberValue)
rs2.MoveNext
Loop

Do Until rs3.EOF
'Debug.Print rs3!MemberValue
NewProject.InstitutionComboBox.AddItem (rs3!MemberValue)
rs3.MoveNext
Loop

Do Until rs4.EOF
'Debug.Print rs3!MemberValue
NewProject.ProjClassComboBox.AddItem (rs4!MemberValue)
rs4.MoveNext
Loop

'Display user form
NewProject.Show

'Open new sheet and set initial view
FileNew Template:=""
ViewApply Name:="_Pilot View"

'Get
 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by Gary L. Ch » Sat, 08 Nov 2008 03:10:47

ndy:

You do know there is a developer group?

--
----------
Gary L. Chefetz, MVP
MSProjectExperts
Project Server Consulting: http://www.msprojectexperts.com
Project Server Training: http://www.projectservertraining.com
Project Server FAQS: http://www.projectserverexperts.com
Project Server Help Blog: http://www.projectserverhelp.com


< XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...