Re: Going to the specific record
- From: "Karan" <Karan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 05:42:01 -0700
Thanks it works great!!!
One more small doubt, how about multiple records with the same Case_ID, in
your example it is not possible as it is a auto number. But, in my database
i do have duplicates. Any help will be greatly accepted.
Once again thanks for your valuable tips.
Karan.
"Carl Jansson via AccessMonster.com" wrote:
> I have solved the same problem in my database by putting in a search field
> in the form header that allows a user to jump to the correct ID of that
> record.
>
> The field in my database which is searched is called Case_ID which i an
> autonumber
>
> *************
> In the form header create a unbound textbox, in my case it is called
> search_fix_txt. Then create a button, in my example Cmd_search_fix) that
> will execute the following code on click:
>
> Private Sub Cmd_search_fix_Click()
> Dim str_fix_id As String
> Dim strSearch As String
>
> 'Check search_fix_txt for Null value or Nill Entry first.
>
> If IsNull(Me![search_fix_txt]) Or (Me![search_fix_txt]) = "" Then
> MsgBox "Enter a value!!", vbOKOnly, "Invalid choice!"
> Me![search_fix_txt].SetFocus
> Exit Sub
> End If
> '---------------------------------------------------------------
>
> 'Performs the search using value entered into search_fix_txt
> 'and evaluates this against values in case_ID
>
> DoCmd.ShowAllRecords
> DoCmd.GoToControl ("case_ID")
> DoCmd.FindRecord Me!search_fix_txt
>
> case_ID.SetFocus
> str_fix_id = case_ID.Text
> search_fix_txt.SetFocus
> strSearch = search_fix_txt.Text
>
> 'If matching record found sets focus in case_ID
> 'and clears search control
>
> If str_fix_id = strSearch Then
> case_ID.SetFocus
> search_fix_txt = ""
>
> 'If value not found sets focus back to search_fix_txt and shows msgbox
> Else
> MsgBox "Could not find a fix with number " & strSearch, _
> , "Could not find a fix"
> search_fix_txt.SetFocus
> search_fix_txt = ""
> End If
> End Sub
>
> *************
>
> Best regards
> Carl
>
> --
> Message posted via http://www.accessmonster.com
>
.
- References:
- Going to the specific record
- From: Karan
- Re: Going to the specific record
- From: Carl Jansson via AccessMonster.com
- Going to the specific record
- Prev by Date: combo box
- Next by Date: RE: combo box
- Previous by thread: Re: Going to the specific record
- Next by thread: Unable to select last entry in a combo box
- Index(es):