General discussion

  • Creator
    Topic
  • #2114994

    Access DB: FindRecord Method

    Locked

    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”

All Comments

  • Author
    Replies
    • #3827440

      Access DB: FindRecord Method

      by donq ·

      In reply to Access DB: FindRecord Method

      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.

    • #3795081

      Access DB: FindRecord Method

      by jbon_2000 ·

      In reply to Access DB: FindRecord Method

      This question was closed by the author

Viewing 1 reply thread