Find Record

J

Joan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top