Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Memory, or bad code???

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.


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

    Cheers

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    ill look into techio side

    suggest pos the code script so we can all see it and help if we can

    Jack
    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    When you say "it dies", are you getting a runtime error, Excel will now be put to death error, or what?
    Tom

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The good 'ole Dr. Watson (being run in NT, xl97) xl will be put to death error...
    How long a minute is depends on which side of the bathroom door you are standing...

    Cheers

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  8. #8
    Board Regular
    Join Date
    May 2002
    Location
    Ipswich, Suffolk, England
    Posts
    136
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    up grade your other PC

  9. #9
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Wow, I can't believe I didn't think of that before... What a great idea... ?????

    Obviously, that's not an option!



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

    Cheers

  10. #10
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What do you think folks??

    Any ideas?



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

    Cheers

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •