Set active record in continuous form

G

Guest

Hi, I have a number of records that are displayed on a continuous form. I
wish to double click on one of the fields in a record (Surname) and then go
to a form to edit that record , with the edit form already having the
corresponding record displayed. Thus, if I double click on the record with
the Surname Smith, I automatically go to the Smith's record in the edit form.

What steps do I need to take? Should I do something like set the desired
button as "active" then tell the edit form to go to the active record, (if so
how?) or is there an easier way.

Thank you,

Tim.
 
A

AlCamp

Timboo,
Try coding the fields dbl-click event with code that will open the form,
and use the OpenForm WhereCondition argument to identify the specific record
to view.
See OpenForm Method in Help...
Also, realize that using LastName in an WhereCondition may cause multiple
solutions. Better to use a unique identifier to locate the record...
preferably an indexed key field such as a CustomerID.
hth
Al Camp
 
G

Guest

Al,

Ive done as you sugggest, and the code I have used sits behind the
ondoubleclick event of a control on the FrmMainClinicDetailsSubform control -

DoCmd.OpenForm "FrmRecUpdate", , , [PatientNo] =
Forms![FrmMainClinicDetailsSubform]![PatientNo]

But although the process runs, when the FrmRecUpdate opens to edit the
record, it always opens with the first record in the table, rather than the
record selected in the FrmMainClinicDetailsSubform form.

Any ideas as to why, have I got the code wrong?

Thanks Tim.
 
A

Albert D. Kallal

DoCmd.OpenForm "FrmRecUpdate", , , [PatientNo] =
Forms![FrmMainClinicDetailsSubform]![PatientNo]

You above code is not right. Try the folwling focoe:
 

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