Hi,
I have one small application (VB6, ADO, Access) with one form ans following project references:
VB for applications
VB runtime
VB objects & procedures
OLE automation
MS ActiveX Data Object 2.7 Library
Everything seems working OK, but when I want to build msi file using VS installer 6, it takes between 5 to 10 minutes!!!
I have on the same computer about 10 other applications (the same or bigger - up to 8000 lines of code and over dozen forms) and for all others msi is built in just a few seconds. I don't see any difference and reason why just this one should take so long. I tried to delete all the installer files and build it again but the result was the same - over 5 minutes to build msi.
The code is as follows:
Option Explicit
Dim cn As ADODB.Connection
Dim ssql As String
Private Sub Combo2_Click()
On Error GoTo nodata
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs2("alpha_code")
ssql = "select, [w] from snowload where ( [st]=""" & mystate & """ and [county]=""" & Combo2.Text & """ )"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = Combo1.Text
Text3.Text = Combo2.Text
Text4.Text = rs1("s")
Text5.Text = rs1("w")
Exit Sub
nodata:
MsgBox "No data found."
End Sub
Private Sub Combo2_GotFocus()
On Error Resume Next
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
If Len(Combo1.Text) < 2 Then
MsgBox ("Select state first.")
Exit Sub
End If
Combo2.Clear
Combo3.Clear
Combo3.Text = ""
Text1.Text = ""
Text2.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs1("alpha_code")
ssql = "select [county] from ziplist where [state]=""" & mystate & """ group by [county];"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs2.EOF
Combo2.AddItem rs2("county")
rs2.MoveNext
Wend
End Sub
Private Sub Combo3_Click()
On Error GoTo nodata
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
Dim mycounty As String
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs2("alpha_code")
ssql = "select [county] from ziplist where [state]=""" & mystate & """ and [city]=""" & Combo3.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mycounty = rs2("county")
ssql = "select, [w] from snowload where ( [st]=""" & mystate & """ and [county]=""" & mycounty & """ )"
Debug.Print ssql
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = Combo1.Text
Text3.Text = mycounty
Text4.Text = rs1("s")
Text5.Text = rs1("w")
Exit Sub
nodata:
MsgBox "No data found."
End Sub
Private Sub Combo3_GotFocus()
On Error Resume Next
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
If Len(Combo1.Text) < 2 Then
MsgBox ("Select state first.")
Exit Sub
End If
Combo2.Clear
Combo3.Clear
Combo2.Text = ""
Text1.Text = ""
Text2.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs1("alpha_code")
ssql = "select [city] from ziplist where [state]=""" & mystate & """ group by [city];"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs2.EOF
Combo3.AddItem rs2("city")
rs2.MoveNext
Wend
End Sub
Private Sub Command1_Click()
On Error Resume Next
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
End Sub
Private Sub Command2_Click()
On Error Resume Next
Form1.PrintForm
End Sub
Private Sub Command3_Click()
On Error Resume Next
' OpenDocument ("End Sub
Private Sub Command4_Click()
On Error Resume Next
cn.Close
End
End Sub
Private Sub Form_Load()
On Error GoTo CHYBA
Dim rs1 As ADODB.Recordset
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\LDATA.MDE"
ssql = "select * from states"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs1.EOF
Combo1.AddItem rs1("state")
rs1.MoveNext
Wend
Exit Sub
CHYBA:
MsgBox "No data found."
End Sub
Public Function OpenDocument(DocumentWithPath As String) As Long
OpenDocument = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocumentWithPath, vbNormalFocus)
End Function
Private Sub Form_Unload(Cancel As Integer)
cn.Close
End Sub
Private Sub Text1_Change()
On Error GoTo nozip
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
Dim mycounty As String
If Len(Text1.Text) = 5 Then
Me.MousePointer = vbHourglass
ssql = "select [state], [county] from ziplist where [zip]=""" & Text1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mycounty = rs2("county")
mystate = rs2("state")
ssql = "select, [w] from snowload where ( [st]=""" & mystate & """ and [county]=""" & mycounty & """ )"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text4.Text = rs1("s")
Text5.Text = rs1("w")
ssql = "select [state] from states where [alpha_code]=""" & mystate & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = rs2("state")
Text3.Text = mycounty
Me.MousePointer = vbDefault
End If
Exit Sub
nozip:
MsgBox "No match for entered ZIP code."
'Resume Next
End Sub
Private Sub Text1_GotFocus()
Command1_Click
'Text1.Text = ""
End Sub
I have one small application (VB6, ADO, Access) with one form ans following project references:
VB for applications
VB runtime
VB objects & procedures
OLE automation
MS ActiveX Data Object 2.7 Library
Everything seems working OK, but when I want to build msi file using VS installer 6, it takes between 5 to 10 minutes!!!
I have on the same computer about 10 other applications (the same or bigger - up to 8000 lines of code and over dozen forms) and for all others msi is built in just a few seconds. I don't see any difference and reason why just this one should take so long. I tried to delete all the installer files and build it again but the result was the same - over 5 minutes to build msi.
The code is as follows:
Option Explicit
Dim cn As ADODB.Connection
Dim ssql As String
Private Sub Combo2_Click()
On Error GoTo nodata
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs2("alpha_code")
ssql = "select
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = Combo1.Text
Text3.Text = Combo2.Text
Text4.Text = rs1("s")
Text5.Text = rs1("w")
Exit Sub
nodata:
MsgBox "No data found."
End Sub
Private Sub Combo2_GotFocus()
On Error Resume Next
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
If Len(Combo1.Text) < 2 Then
MsgBox ("Select state first.")
Exit Sub
End If
Combo2.Clear
Combo3.Clear
Combo3.Text = ""
Text1.Text = ""
Text2.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs1("alpha_code")
ssql = "select [county] from ziplist where [state]=""" & mystate & """ group by [county];"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs2.EOF
Combo2.AddItem rs2("county")
rs2.MoveNext
Wend
End Sub
Private Sub Combo3_Click()
On Error GoTo nodata
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
Dim mycounty As String
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs2("alpha_code")
ssql = "select [county] from ziplist where [state]=""" & mystate & """ and [city]=""" & Combo3.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mycounty = rs2("county")
ssql = "select
Debug.Print ssql
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = Combo1.Text
Text3.Text = mycounty
Text4.Text = rs1("s")
Text5.Text = rs1("w")
Exit Sub
nodata:
MsgBox "No data found."
End Sub
Private Sub Combo3_GotFocus()
On Error Resume Next
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
If Len(Combo1.Text) < 2 Then
MsgBox ("Select state first.")
Exit Sub
End If
Combo2.Clear
Combo3.Clear
Combo2.Text = ""
Text1.Text = ""
Text2.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
ssql = "select [alpha_code] from states where [state]=""" & Combo1.Text & """;"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
mystate = rs1("alpha_code")
ssql = "select [city] from ziplist where [state]=""" & mystate & """ group by [city];"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs2.EOF
Combo3.AddItem rs2("city")
rs2.MoveNext
Wend
End Sub
Private Sub Command1_Click()
On Error Resume Next
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
End Sub
Private Sub Command2_Click()
On Error Resume Next
Form1.PrintForm
End Sub
Private Sub Command3_Click()
On Error Resume Next
' OpenDocument ("End Sub
Private Sub Command4_Click()
On Error Resume Next
cn.Close
End
End Sub
Private Sub Form_Load()
On Error GoTo CHYBA
Dim rs1 As ADODB.Recordset
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\LDATA.MDE"
ssql = "select * from states"
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
While Not rs1.EOF
Combo1.AddItem rs1("state")
rs1.MoveNext
Wend
Exit Sub
CHYBA:
MsgBox "No data found."
End Sub
Public Function OpenDocument(DocumentWithPath As String) As Long
OpenDocument = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocumentWithPath, vbNormalFocus)
End Function
Private Sub Form_Unload(Cancel As Integer)
cn.Close
End Sub
Private Sub Text1_Change()
On Error GoTo nozip
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim mystate As String
Dim mycounty As String
If Len(Text1.Text) = 5 Then
Me.MousePointer = vbHourglass
ssql = "select [state], [county] from ziplist where [zip]=""" & Text1.Text & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
mycounty = rs2("county")
mystate = rs2("state")
ssql = "select
Set rs1 = New ADODB.Recordset
rs1.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text4.Text = rs1("s")
Text5.Text = rs1("w")
ssql = "select [state] from states where [alpha_code]=""" & mystate & """;"
Set rs2 = New ADODB.Recordset
rs2.Open ssql, cn, adOpenKeyset, adLockOptimistic
Text2.Text = rs2("state")
Text3.Text = mycounty
Me.MousePointer = vbDefault
End If
Exit Sub
nozip:
MsgBox "No match for entered ZIP code."
'Resume Next
End Sub
Private Sub Text1_GotFocus()
Command1_Click
'Text1.Text = ""
End Sub