General discussion

Locked

Access DB: FindRecord Method

By jbon_2000 ·
I have used DoCmd.FindRecord to search for an ID #. When used, it searches all Fields. If I limit it to the Current Field, it finds nothing. Does anyone have tips. See Code Below:

Private Sub cmdSearch_Click()
On Error GoTo Err_cmdSearch_Click
DoCmd.OpenForm "Book Form"
txtNum.SetFocus

If Not txtNum.Value = "" Then
DoCmd.FindRecord txtNum.Value, acDown, , acSearchAll, True, acAll
txtNum.Value = ""
DoCmd.Close acForm, "ID # Search"

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access DB: FindRecord Method

by donq In reply to Access DB: FindRecord Met ...

I go about FindRecord a little differently.

1st. I place a Find (binoculars button) on my form. Assess builds the code I need for me.

2nd. I create a query that finds the record I want and switch to SQL View and copy the code to the clipboard.

3rd. Then I re-open my Form and substitute my clipboard SQL Statement for the Find button statement.

CAUTION: If you need to find a variable record build a combo box to deliver ONLY filter values that are needed and place "[Forms]![FormName].[ComboBoxName] in the criteria area of the query constructed in step 2. Then have the combo box's After Update event call your report - which uses your query as its record source.

Collapse -

Access DB: FindRecord Method

by donq In reply to Access DB: FindRecord Met ...

Your WHERE Clause is missing!

Collapse -

Access DB: FindRecord Method

by jbon_2000 In reply to Access DB: FindRecord Met ...

I was using VB, not macros.

Collapse -

Access DB: FindRecord Method

by jbon_2000 In reply to Access DB: FindRecord Met ...

This question was closed by the author

Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Software Forums