Clarifying a Selected Record

  • Thread starter Thread starter Adam
  • Start date Start date
A

Adam

Hi,

I have a form (form1) with a subform linked master/child.

On form1, I want to insert a command button that when
clicked will open another form (form2) based on a selected
record from the the subform.

The following vb code works if it is attached to form2's
On Activate event.

DoCmd.FindRecord Forms![GSP]![Customer]![Customer
Subform].Form![CustID]

The problem I'm having is that if that customer has
multiple records, it goes to the first of those records,
ie the first appointment date in a series of appointment
dates.

I'd like to be able to select record on two criteria ie
Customer Id and appointment date.

Can this be done may I ask?

Adam
 
Try

Me.Recordset.FindFirst "[Field1]=" & Forms![GSP]![Customer]![Customer
Subform].Form![CustID] & " And [Field2]= #" &
Forms![GSP]![Customer]![Customer Subform].Form![AptDate] & "#"

The # signs are date delimiters. If the field you're searching is text,
you'll also have to adjust for that. If you are using Access 97 or older,
you'll need to make a RecordsetClone, do the search on it, then set the
form's bookmark = the clone's bookmark.
 
Back
Top