Slow Code

livvie

Registered User.
Local time
Today, 23:11
Joined
May 7, 2004
Messages
158
The following piece of code is terribly slow in my app. How can I speed it up.
If Me.txtpartno = "" Then
MyPartName = Me.txtPartName
rstEst.Find "PartName = " & "'" & MyPartName & "'"
Else
MyPartno = Me.txtpartno
rstEst.Find "PartNo = " & "'" & MyPartno & "'"
End If

I have used the rst.Find method elsewhere on bigger tables and it's not as slow.
 
Have you tried indexing MyPartName?

kh
 
KenHigg said:
Have you tried indexing MyPartName?

kh
Thanks mate, everywhere else I use it I am searching on the PK field so the indexing was already done.
Thanks alot
 
This may not speed things up but you may want to loose some "&"s...

If Me.txtpartno = "" Then
MyPartName = Me.txtPartName
rstEst.Find "PartName = '" & MyPartName & "'"
Else
MyPartno = Me.txtpartno
rstEst.Find "PartNo = '" & MyPartno & "'"
End If


kh
 
KenHigg said:
This may not speed things up but you may want to loose some "&"s...

In this instance the speed gain wouldn't be noticeable. Concatenation, however, can slow processes.
 
So you have your parts rs open and you want to find a part by part number or part name. Is this correct? I can see searching and finding a unique part number, but are the part names unique also? Seem's you could have multiple parts with the same name...

???
kh
 
KenHigg said:
So you have your parts rs open and you want to find a part by part number or part name. Is this correct? I can see searching and finding a unique part number, but are the part names unique also? Seem's you could have multiple parts with the same name...

???
kh

That's correct, the users tell me the part names are never the same but I'm not convinced. It makes it even more complicated when the partno or name can be blank.
 
1. What exactly does this pc of code do?

2. Seem's you could do a quick totals/count on part names in the table and present your argument against using this method...

kh
 
KenHigg said:
1. What exactly does this pc of code do?

2. Seem's you could do a quick totals/count on part names in the table and present your argument against using this method...

kh

This code is finding an estimate based on one selected on a form and then editing a field on this record . Maybe there is an easier way of doing it.
 

Users who are viewing this thread

Back
Top Bottom