small Ms access problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arnold
    New Member
    • Apr 2007
    • 6

    small Ms access problem

    Hi all,

    I have created a form which gives the user the ability to search for specific data. Number of records in my database exceed one million records therefore in some occasion the searching takes an approximately a long time. Hence I have decided to show a hint message to inform the user that searching is going on and he has to wait. So in this regard I have created a label which is invisible at the beginning when the user presses the find button it becomes visible and when the searching is over it becomes invisible again. My big problem is that the label is not being showed or displayed when the user press the find button. The following codes might illustrate my problem. I would be much grateful if somebody can provide me with a hint or solution for my problem.

    Note: even if I removed the lines which make my label invisible the label is only displayed when the search is over.

    my code goes here
    [
    Private Sub cmd_find_Click( )
    Select Case og_search_eleme nts
    Case 1
    strCriteria = "[phone_no] Like '" & txt_search & "'"
    Case 2
    strCriteria = "[name] Like '" & txt_search & "'"
    Case 3
    strCriteria = "[address] Like '" & txt_search & "'"
    Case 4
    strCriteria = "[phone_no] Like '" & txt_search & "'" _
    & "or [name] Like '" & txt_search & "'" _
    & "or [address] Like '" & txt_search & "'"

    End Select

    'display the searching label
    Me.lbl_searchin g_msg.Visible = True

    Set rst = [Forms]![frm_client_deta ils].RecordsetClone


    rst.FindFirst strCriteria

    If rst.NoMatch Then

    'Hide the searching label
    Me.lbl_searchin g_msg.Visible = False
    msgbox "No data has been found"
    Else
    [Forms]![frm_client_deta ils].Bookmark = rst.Bookmark

    'Hide the searching label
    Me.lbl_searchin g_msg.Visible = False

    End If

    Set rst = Nothing
    End Sub

    ]
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Try this ...
    Code:
    Private Sub cmd_find_Click()
    
       'display the searching label
        Me.lbl_searching_msg.Visible = True
    
       Select Case og_search_elements
            Case 1
                strCriteria = "[phone_no] Like '" & txt_search & "'"
            Case 2
                strCriteria = "[name] Like '" & txt_search & "'"
            Case 3
               strCriteria = "[address] Like '" & txt_search & "'"
            Case 4
               strCriteria = "[phone_no] Like '" & txt_search & "'" _
                     & "or [name] Like '" & txt_search & "'" _
                     & "or [address] Like '" & txt_search & "'"
            
        End Select
    
       Set rst = [Forms]![frm_client_details].RecordsetClone
    
       rst.FindFirst strCriteria 
    
       If rst.NoMatch Then
    	  msgbox "No data has been found"
       Else
            [Forms]![frm_client_details].Bookmark = rst.Bookmark
    
       End If
    
       'Hide the searching label
       Me.lbl_searching_msg.Visible = False
    
        Set rst = Nothing
    End Sub

    Comment

    Working...