Memory, or bad code???

charlie79

Board Regular
Joined
Feb 27, 2002
Messages
97
Please help!

I've been pulling my hair out over this for a couple hours now, and can't figure it out. Here's the prob, I have an excel app that is runable in xl97 and xl2k. I'm using the click event of a label to bring up a userform with a combobox containing records from an access db. The user then selects one of the records, the userform "hides" and I then calculate a specific range of about 100 cells, base on the choice the user made from the form. Follow me? Well, here's where the problem lies. From my laptop, pIII 1.13Ghz 256MG Ram, it all works fine (xl2k). From a PI 166 64MG Ram, it dies if I click on the label right after the form "hides" (xl97). Only if I click the label right away after the form hiding. Anybody follow this? I sure hope so cuz I'm about to give up here....


Thanks in advance.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Here you go, not sure if can make sense of this, sometimes I can't.


*********************************************

Private Sub lblSelectGrade_Click()
Cells(1, 1).Select
frmSimulator.Show
End Sub

******************************************************

Private Sub UserForm_Initialize()

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

statement = "SELECT grade FROM grades" & Chr(0)

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDBPath & ";"
Set rs = New ADODB.Recordset
Set rs = cn.Execute(statement, , adCmdText)

cboGrades.Clear
Do While Not rs.EOF
cboGrades.AddItem rs!grade
rs.MoveNext
Loop
cboGrades.ListIndex = 0

End Sub

******************************************************
'cboGrades is the combobox

Private Sub cboGrades_Change()
frmSimulator.Hide
Sheet1.lblSelectGrade.Caption = cboGrades.Value
Call SimTarget(strDBPath, "V_EXCEL_EXPORT", Cells(19, 1))
End Sub


******************************************************

Sub SimTarget(DBFullName As String, TableName As String, TargetRange As Range)
On Error GoTo SimTarget_err
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim statement As String
Dim intAppRow As Integer
Dim intTrgRow As Integer
Dim success As Boolean

Sheet1.Unprotect "hmx"
intAppRow = 7
success = False
statement = "SELECT * FROM V_EXCEL_EXPORT"

Set TargetRange = TargetRange.Cells(1, 1)
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DBFullName & ";"
Set rs = New ADODB.Recordset

Set rs = cn.Execute(statement, , adCmdText)
rs.MoveFirst

'Populate targets for Sim Grade
rs.MoveFirst
intAppRow = 7
For intTrgRow = 7 To 48
While success = False
If rs.EOF Then
Cells(67, intTrgRow).Value = " "
intAppRow = intAppRow + 1
success = True
ElseIf Cells(3, intAppRow).Value = rs!app_desc And Sheet1.lblSelectGrade.Caption = rs!grade Then
Cells(67, intTrgRow).Value = rs!target
intAppRow = intAppRow + 1
success = True
End If
If Not rs.EOF Then
rs.MoveNext
End If
Wend
success = False
rs.MoveFirst
Next intTrgRow
Call SimBatch

'Close everything
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Sheet1.Protect "hmx"
SimTarget_err:
Exit Sub
End Sub

********************************************



_________________
How long a minute is depends on which side of the bathroom door you are standing...

Cheers
This message was edited by charlie79 on 2002-05-09 12:44
 
Upvote 0
When you say "it dies", are you getting a runtime error, Excel will now be put to death error, or what?
Tom
 
Upvote 0
suggest open on lap top and save as another name in version 2000b then try on other PCs lap tops.

thisis from the evedence you give,

think exel getting grumpy.

make sure to save as correct current verson 97 2000 are OK
 
Upvote 0
I'll try that, however I don't think it's going to work since I have three workbooks that are pretty much the same, and they all do it.

Didn't work... Any other ideas?
This message was edited by charlie79 on 2002-05-10 05:41
 
Upvote 0
Wow, I can't believe I didn't think of that before... What a great idea... ?????

Obviously, that's not an option!
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top