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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Flicker / Refresh...

Status
Not open for further replies.

MkIIISupra

Programmer
Apr 17, 2002
108
US
I have a series of forms that I am using to display a variety of information. There is a SUB_frm embeddeds with in as well. Anyhow, the issue I have having is with a search command I have created for the users. In this search they can specify one of three fields to search. And it all works great! But while the search is going you can see the records whiz by. Unlike the actual search feature which looks then displays.

How can I stop the records from whizzing by but still get the search to work?

Below is my code to assist with this question:

Private Sub txtSearch_KeyPress(KeyAscii As Integer)
' ******************************************************************* _
This is the search feature. This allows the user the ability to find _
the appropriate record. _
*******************************************************************

cnt = 0

If (KeyAscii) = vbKeyEscape Then
' Reset all the buttons to a visible state...
Me.txtSearch.Value = ""
Me.btnMstLog.Enabled = True
Me.btnUpdate.Enabled = True
Me.btnOpenSnap.Enabled = True

DoCmd.GoToRecord , , acFirst
Me.firstName.SetFocus

End If

If (KeyAscii) = 13 Then
DoCmd.GoToRecord , , acFirst

Do
If
(Me.txtSearch.Value) = Me.stateDistNum Then
Me.txtSearch.Value = ""
Me.firstName.SetFocus
Me.btnMstLog.Enabled = True
Me.btnUpdate.Enabled = True
Me.btnOpenSnap.Enabled = True

If
IsNull(Me.eMail.Value) Then
Me.lblEmail.Visible = True
Me.btnEmailCustomer.Visible = False
Else

Me.lblEmail.Visible = False
Me.btnEmailCustomer.Visible = True
End If

Exit Sub

ElseIf
(Me.txtSearch.Value) = Me.lastName Then
Me.txtSearch.Value = ""
Me.firstName.SetFocus
Me.btnMstLog.Enabled = True
Me.btnUpdate.Enabled = True
Me.btnOpenSnap.Enabled = True

If
IsNull(Me.eMail.Value) Then
Me.lblEmail.Visible = True
Me.btnEmailCustomer.Visible = False
Else

Me.lblEmail.Visible = False
Me.btnEmailCustomer.Visible = True
End If

ElseIf
(Me.txtSearch.Value) = Me.distName Then
Me.txtSearch.Value = ""
Me.firstName.SetFocus
Me.btnMstLog.Enabled = True
Me.btnUpdate.Enabled = True
Me.btnOpenSnap.Enabled = True

If
IsNull(Me.eMail.Value) Then
Me.lblEmail.Visible = True
Me.btnEmailCustomer.Visible = False
Else

Me.lblEmail.Visible = False
Me.btnEmailCustomer.Visible = True
End If

Exit Sub
End If


DoCmd.GoToRecord , , acNext
cnt = cnt + 1

Loop Until cnt = Me.SUB_frmCountMasterContacts!countContacts

Me.txtSearch.Value = "No Match found..."
Me.lblEmail.Visible = True
Me.btnEmailCustomer.Visible = False

End If

End Sub



One by one the penguins steal my sanity!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top