B
Ben Lahoy
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
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