Professional Web Applications Themes

Find Record - Microsoft Access

I have an unbound dialog form with three textboxes on it for the user to enter either a delivery date, a booking number or a breedercode(text). The user wants to be able to choose a booking record by any of these three fields and then view the booking records in datasheet view with the cursor at the record they specified, or in the case of the date, at the first record with the date that they entered. Below is the code that I used on the txtBreeder After Update event: Private Sub txtBreeder_AfterUpdate() DoCmd.OpenForm "BrowseBookings", acFormDS DoCmd.FindRecord Me.txtBreeder Me.txtBreeder = ...

  1. #1

    Default Find Record

    I have an unbound dialog form with three textboxes on it for the user to
    enter either a delivery date, a booking number or a breedercode(text). The
    user wants to be able to choose a booking record by any of these three
    fields and then view the booking records in datasheet view with the cursor
    at the record they specified, or in the case of the date, at the first
    record with the date that they entered. Below is the code that I used on
    the txtBreeder After Update event:

    Private Sub txtBreeder_AfterUpdate()
    DoCmd.OpenForm "BrowseBookings", acFormDS
    DoCmd.FindRecord Me.txtBreeder
    Me.txtBreeder = ""
    End Sub

    This works as it is supposed to, however when I use the following
    subprocedures for the other two textboxes, the datasheet form opens with the
    cursor at the first record.


    Private Sub txtBookingNum_AfterUpdate()
    DoCmd.OpenForm "BrowseBookings", acFormDS
    DoCmd.FindRecord Me.txtBookingNum
    Me.txtBookingNum = ""
    End Sub

    Private Sub txtDelivery_AfterUpdate()
    DoCmd.OpenForm "BrowseBookings", acFormDS
    DoCmd.FindRecord Me.txtDelivery
    Me!txtDelivery = ""
    End Sub

    Booking Number is the primary key of Bookings and I have Bookings indexed on
    Booking Number, Delivery Date and BreederCode. The form's, "BrowseBookings"
    record source is a query. What am I missing here?

    Joan


    Joan Guest

  2. #2

    Default Find record

    I've created a parts inventory DB and form with the part
    number as primary key. The default Find Record feature
    works but I would prefer to use another method to search
    for a record. Using the form view I envision a field to
    enter the part number and an associated command button to
    locate/display the record in the form. So far I have been
    unsuccessful with the macros. Any help would be
    appreciated. THX

    Larry
    Larry Guest

  3. #3

    Default Re: Find record

    Create an unbound text box with the name txtPartNo then try putting the
    following code in the afterupdate event of the text box

    Dim rs As Object
    Set rs = Me.RecordsetClone
    rs.findfirst "PartNo= " & [txtPartNo]
    Me.Bookmark = rs.Bookmark

    If your part number is alphanumeric change

    rs.findfirst "PartNo = ' " & [txtPartNo] & " ' "

    Ignore the spaces before and after the ' symbol. I just did it so its
    easier to read.

    Kelvin

    "Larry" <net> wrote in message
    news:03a001c37195$e6768a60$gbl... 


    Kelvin Guest

Similar Threads

  1. find row number of specific record in another query
    By speedyG in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: March 4th, 02:09 PM
  2. Find record w/ conditions met in the same child record
    By Thomas Berg in forum FileMaker
    Replies: 2
    Last Post: October 21st, 05:01 AM
  3. CDML Find User Record at Logon
    By Colin Bannister in forum FileMaker
    Replies: 1
    Last Post: August 13th, 07:53 AM
  4. ADOXtra: find record
    By James G webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: August 6th, 10:20 AM
  5. Routine to find the correct pageindex for a given record.
    By Jim Mitchell in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: August 2nd, 12:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139