Connecting Tech Pros Worldwide Help | Site Map

Using DoCmd.FindRecord

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 10th, 2008, 06:25 PM
Ben Lahoy
Guest
 
Posts: n/a
Default Using DoCmd.FindRecord

Hi!

My problem is basically in a search modal window, where the user is allowed
to make a selection on which option to take. After selecting an option and
then giving the data to search, the user clicks the "OK" button and the user
gets taken back to the "Customer" form with the correct searched record.
The function works fine except that every now and then it takes 3-5 seconds
to close the search modal window and goes back to the "Customer" form after
clicking the "OK" button

Below is the actual code for the "OK" button:
- - - - - - - - - - - - - - - - - - - - - - -
On Error GoTo OK_Click_Err
If IsNull(Forms![yCustomer Search Dialog]![By Search Type]) Then
Response = MsgBox("You Did Not Select a Record to Search For", 32, "No
Record Selected")
Else
DoCmd.SelectObject A_FORM, "Customers"
Forms![Customers]![Customer Number].SetFocus
DoCmd.FindRecord [Forms]![yCustomer Search Dialog]![By Search Type],
A_ENTIRE, False, A_DOWN, False, A_CURRENT

Select Case Me.Type_of_Search
Case 1
Forms![Customers]![CustomerSubFrm].Form![First Name].SetFocus
Case 2
Forms![Customers]![CustomerSubFrm].Form![Company].SetFocus
Case 3
Forms![Customers]![Customer Number].SetFocus
Case 4
Forms![Customers]![CustomerSubFrm].Form![Phone].SetFocus
End Select

DoCmd.Close A_FORM, "yCustomer Search Dialog"
End If
Exit Sub

OK_Click_Err:
MsgBox "Error is " & Error$ & Chr(13) & Chr(10) & "In yCust Search
OK_Button" & Chr(13) & Chr(10) & CPBSMSG, 16
Exit Sub
- - - - - - - - - - - - - - - - - - - - - - -

Aside from using "DoCmd.FindRecord" command, are there other ways to find a
record that is faster?

I have a couple of ideas but what I am asking are the ways to do it in
Access and not in MS SQL.

Using the "DoCmd.FindRecord" command seems to be slow every now and then.
It takes 3 to 5 seconds sometimes to execute.

But if you see another cause, in the code, that slows down the performance,
please let me know.



Thanks,

Ben



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.