Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003

    Unanswered: List box Click event speed

    I coded a list box Click event on a lap top. When the event occurs several text box's are updated with values. The event is instantaneous on the lap top I coded it on. I get back to work and move a copy of the updated form into the latest and greatest version of my project. When trigger the event the same code that was instantaneous before is no longer executed at the same speed and takes 10 seconds to run!!

    Any thoughts as to what could all of sudden lengthen the time it takes to execute the same code? The 2 machines are almost identical. I even tried running the event on a different lap top and still the same

    I have narrowed it down to the function in which is all of sudden slow but cannot figure out why it is so slow now? Nothing has changed.

    Is there a way to work with linked databases better than in my function below? I'm pretty sure that this line is what's slowing me up

    Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot) ' Look in component table first

    Any other ways to do this faster?

    Public Function Return_Component_Value(strTable, strField, strDftField, tbcPage) As Currency
    On Error GoTo Err_Return_Component_Value

    Dim db As Database
    Dim rst As Recordset
    Dim strSQL As String, strSol_ID As String

    strSol_ID = Curr_SolID_Selected ' Find out which Sol ID was selected and use in query below

    strSQL = "SELECT " & strTable & "." & strField & " FROM " & strTable & " WHERE (((" & strTable & ".Sol_ID)= '" & strSol_ID & "'));"

    Set db = CurrentDb

    Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot) ' Look in component table first

    If rst.RecordCount = 1 Then 'Exit Function

    Return_Component_Value = rst.Fields(strField).Value ' Return component value field



    ElseIf tbcPage.Name = "Costs" Then ' Rate not found in Estimated Cost table; exit funct. and return 0

    Exit Function

    ElseIf rst.RecordCount = 0 Then ' record not found in component tables, look in tblSol


    Set rst = Nothing

    strSQL = "SELECT tblSol." & strDftField & " FROM tblSol WHERE (((tblSol.Sol_ID)='" & strSol_ID & "'));"

    Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot) ' Look in tblSol for default rate

    Return_Component_Value = rst.Fields(strDftField).Value ' Return value



    End If

    Set rst = Nothing
    Set db = Nothing
    Exit Function

    MsgBox err.Description
    Resume Exit_Return_Component_Value

    End Function

    Any comment would be greatly appreciated.
    Last edited by waderw24; 12-08-03 at 19:30.

  2. #2
    Join Date
    Nov 2003
    Maybe check the setup Options in Access (on both computers) and see if they match up

    Menu: Tools - Options - Advanced Tab

    Just a thought.

Posting Permissions

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