Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi Threading in Access 2

Status
Not open for further replies.

eatwork

Technical User
May 16, 2005
155
CA
Hi,
I was wondering if Multi-threading is possible in access 2003 and if so, how exactly is it done, eg of simple syntax.
I have an access form, which on open sets a timer variable. The form timer is then set to call a method which calls a couple dlookups to write text to a label. The dlookups seem to be taking a like 10 seconds to complete, but I don't want the system to hang for the few seconds while the label is being re written. Thank you.
 
How are ya eatwork . . .

There are registry settings you can tweak, but since your using one of the slowest methods available (aka an aggregate function) you won't know until you switch to a faster method. [blue]Recordsets[/blue] for example! (definitely faster . . . particularly for large recordsets, and no tweaking!).

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
As well, perhaps your performance would improve if you indexed whichever field you were looking up.
 
Hello TheAceMan1,
Whats shakin?

I did not know that the dlookup and dcounts were aggregate functions, and that they were the slowest methods available. The dcounts and dlookups I am utilizing are coming from queries already, is there another way to access that data without using the dlookups/dcounts? For example, should I be utilizing the docmd.runsql methods to improve performance? Thanks

code currently looks like:
Code:
    Dim notInvoicedCount As Integer
    notInvoicedCount = DCount("*", "qryNOTINVOICEDPARENT", "")
    Dim storageLastReviewedOn As Date
    storageLastReviewedOn = Format(DLookup("value", "tbl_CONSTANT", "constantType='Storage Reviewed Last On'"), "mm/dd/yyyy")
    Dim storageItemsCount As Integer
    storageItemsCount = DCount("*", "qryStorageCommodities", "Status='Storage'")
 
Hello JoeAtWork,
Thanks for the reply.
I will check to make sure all the fields I am searching for are indexed, I think they are already, but it won't hurt to double check. Thanks
 
eatwork . . .

Sample functions you could use (may need some trimming):
Code:
[blue]Public Function DCnt() As Long
   Dim db As DAO.Database, rst As DAO.Recordset
   Dim notInvoicedCount, SQL As String
   
   Set db = CurrentDb
   SQL = "SELECT * " & _
         "FROM qryNOTINVOICEDPARENT;"
   Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
   
   rst.MoveLast
   notInvoicedCount = rst.RecordCount
   
   Set rst = Nothing
   Set db = nothng
End Function

Public Function DLook() As String
   Dim db As DAO.Database, rst As DAO.Recordset
   Dim storageLastReviewedOn, SQL As String
   
   Set db = CurrentDb
   SQL = "SELECT * " & _
         "FROM tbl_CONSTANT " & _
         "WHERE constantType='Storage Reviewed Last On';"
   Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
   
   storageLastReviewedOn = Format(rst![b][i]FieldName[/b][/i], "mm/dd/yyyy")
   
   Set rst = Nothing
   Set db = Nothing
   
End Function[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top