Jump to content

Complie Error


Recommended Posts

Using Microsoft Visual Basic 6.0Microsoft SQL Enterprise Manager 8.0-- Form1.frmOption ExplicitPrivate Sub cmdDone_Click()EndEnd SubPrivate Sub cmdLookUp_Click()If Trim(Text1.Text) <> "" Then  Call GetStats Else  MsgBox "Please enter a start date", vbExclamation End IfIf Trim(Text2.Text) <> "" Then  Call GetStats Else  MsgBox "Please enter an end date", vbExclamation End IfEnd SubSub GetStats() Dim strSQL As String Dim rst As ADODB.Recordset  strSQL = " CARLA_SEL '" & Text1.Text & "'" & Text2.Text & "'" Call ADO_Query(intCurrentConnection, strSQL, rst)  lstInformation.Clear   List1.Clear   If rst.RecordCount > 0 Then  Do While Not rst.EOF   lstInformation.AddItem Trim(rst("SDATE")) & " " & Trim(rst("EDATE"))		 List1.AddItem Trim(rst("SDATE")) & " " & Trim(rst("EDATE"))	 rst.MoveNext  Loop  lstInformation.Visible = True Else  MsgBox "No stats found for that date range" End IfEnd SubPrivate Sub Command1_Click()Call GetDetailsEnd SubPrivate Sub lstInformation_Click()	Text1.Text = Trim(List1.List(lstInformation.ListIndex))	Text2.Text = Trim(List1.List(lstInformation.ListIndex))Label3.Caption = List1.List(lstInformation.ListIndex)End SubPrivate Sub lstInfo_Click()  	Text1.Text = (lstInformation.ListIndex + 1) & ". " & lstInformation.List(lstInformation.ListIndex)	Text2.Text = (lstInformation.ListIndex + 1) & ". " & lstInformation.List(lstInformation.ListIndex)End SubSub GetDetails()Dim dateStartDate As DateDim dateEndDate As DateDim strSQL As StringdateStartDate = Trim(Label3.Caption)dateStartDate = Trim(Text1.Text)dateEndDate = Trim(Text2.Text)strSQL = " CARLA_PROB1 '" & dateStartDate & "','" & dateEndDate & "','"Call ADO_Execute(intCurrentConnection, strSQL)End SubPrivate Sub Form_Load()Top = 0Left = 0Height = 9000Width = 12000End Sub-- stored Procedure code; CARLA_SELCREATE PROCEDURE CARLA_SELasdeclare@startdate datetime,@enddate datetimebeginselect*from tblRequestMaster RMwhere RM.fldRequestDate=@startdateand RM.fldRequestDate=@enddateendGO--stored procedure code; CARLA_PROB1CREATE PROCEDURE CARLA_PROB1ASDECLARE @startdate datetime,@enddate datetime-- (1) Number of calls received for each priority of call [for a specified date range]select RM.fldPriorityCode as 'Priority',count(RM.fldRequestID) as 'Calls'from tblRequestMaster RMwhere RM.fldPriorityCode between 1 and 5and RM.fldRequestDate between '' and ''and RM.fldRequestFlag like 'D'group by RM.fldPriorityCode unionselect 'Total' as 'Priority',count(RM.fldRequestID) as 'Calls'from tblRequestMaster RMwhere RM.fldPriorityCode between 1 and 5and RM.fldRequestDate between '' and ''and RM.fldRequestFlag like 'D'order by RM.fldPriorityCode ascGOThis is the code in my modules;--mod_ConnectionRoutines.basOption Explicit''************************************************************************************'Module to house the MainConnection calls'************************************************************************************'Public Function ADO_Execute(intConn As Integer, _							strSQL) As Boolean Err.ClearOn Error GoTo ErrHandle:'set timeouts Call SetNewTimeouts ADO_Execute = True With clsConnectionObject  Call .ADO_Execute(intConn, strSQL) End With'reset timeouts Call ResetTimeouts  Exit FunctionErrHandle: Call ResetTimeouts ADO_Execute = False Err.Raise Err.NumberEnd FunctionPublic Function ADO_Query(intConn As Integer, _						  strSQL As String, _						  rst As ADODB.Recordset, _						  Optional CursorType As ADODB.CursorTypeEnum, _						  Optional LockType As ADODB.LockTypeEnum, _						  Optional CursorLocation As ADODB.CursorLocationEnum) As Boolean Err.ClearOn Error GoTo ErrHandle:'set timeouts Call SetNewTimeouts ADO_Query = True With clsConnectionObject  Call .ADO_Query(intConn, strSQL, rst, CursorType, LockType, CursorLocation) End With 'reset timeouts Call ResetTimeouts  Exit Function ErrHandle: Call ResetTimeouts ADO_Query = False Err.Raise Err.NumberEnd FunctionPublic Function ADO_Recordset(intConn As Integer, _						  ByVal strSQL As String, _						  Optional CursorType As ADODB.CursorTypeEnum, _						  Optional LockType As ADODB.LockTypeEnum, _						  Optional CursorLocation As ADODB.CursorLocationEnum) As ADODB.Recordset Err.ClearOn Error GoTo ErrHandle:'set timeouts Call SetNewTimeouts With clsConnectionObject   Set ADO_Recordset = .ADO_Recordset(intConn, strSQL, CursorType, LockType, CursorLocation) End With 'reset timeouts Call ResetTimeouts  Exit Function ErrHandle: Call ResetTimeouts Err.Raise Err.Number End FunctionSub SetNewTimeouts()'routine to set the Component Request timeouts to 1 hour App.OleRequestPendingTimeout = 3600000 App.OleServerBusyTimeout = 3600000End SubSub ResetTimeouts()'routine to reset the Component Request timeouts App.OleRequestPendingTimeout = 10000 App.OleServerBusyTimeout = 10000End Sub--modMainConnect.basOption Explicit'global variables for MainConnectionPublic gstrDSN As StringPublic gstrDBase As StringPublic gstrUser As StringPublic gstrPassword As String'array of all current DB connectionsPublic strConnections(10, 4) As StringPublic intCurrentConnections(10) As IntegerPublic intTotalConnections As Integer'New global connection object for BOISPublic clsConnectionObject As MainConnection.clsMainConnectionPublic intCurrentConnection As IntegerPublic blnConnectionCompleted As BooleanFunction ConnectToServer(strDataSource As String, _					 strUsername As String, _					 strPassword As String, _					 strDBname As String) As Boolean  '*********************************************************'Create an instance of ConnectionObject Set clsConnectionObject = New clsMainConnection'*********************************************************On Error GoTo ErrorHandle'now establish Connection to server database Call clsConnectionObject.ConnectToDB(Trim(strDataSource), Trim(strDBname), Trim(strUsername), Trim(strPassword)) ConnectToServer = True gstrUser = strUsername intCurrentConnection = clsConnectionObject.intConnection Exit Function  ErrorHandle: ConnectToServer = False Err.ClearEnd Function--Module1.basOption ExplicitSub Main()If ConnectToServer("BOISSQL", "itd", "2002", "BOIS") ThenForm1.ShowElseMsgBox "Unsuccessful :::: Unable To Connect" & Err.DescriptionEnd IfEnd Sub

When I try to run the VB code I get the following error;'Compile Error: User-defined type not defined'Can anyone tell me were I am going wrong?Thx~ Floetic ~

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...