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

Find value in any of 5 fields

Status
Not open for further replies.

amourdevin

Technical User
Sep 7, 2003
21
US
I am not an Access expert!

With that said, I would like to create a form that would find a specific integer value in any of five long integer fields on a single table. Once found, I would like to be able to find the next record that has that specific value in any of those five fields.

Thanks in advance!

John
 
What you might try doing is in the design view of the form create a button to find by using the wizzard. After clicking on the find button, enter integer you are looking for. If the pop up box is in the way, simply use the cursor arrow and click on the blue portion to move it out of the way. With the find pop up, you can keep searching.

HTH and that I understood what you were trying to accompolish.

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
 
Thanks!

By default, it searches the current field. Is there an argument, option, etc. that will have it search all fields by default?

Option Compare Database

Private Sub Combo30_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[AssetID] = " & Str(Nz(Me![Combo30], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub FindRecord_Click()
On Error GoTo Err_FindRecord_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_FindRecord_Click:
Exit Sub

Err_FindRecord_Click:
MsgBox Err.Description
Resume Exit_FindRecord_Click

End Sub
 
In the On Click of the button, put something like this

DoCmd.DoMenuItem acFormBar, acEditMenu, 10, ,acMenuVer70

You will need to include some error handling.

Then go to Tools > Options on the Edit/Find tab - Default find/Replace there should be three options, choose the General Search option.

Also, when the Find/Replace box appears, change the location to look in to the name of the table/query that the form is attached to (Record Source).

HTH

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top