Open a form on the correct record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

H

I have a form (datasheet) containing a list of clients. The unique fied is Client_ID. There are 2,400 clients. What I am trying to do is to open a form by clicking on the Client_ID field. I can open the form easily enough but I would like the form to be showing the record for the particular client I selected from the datasheet. Currently, the form just opens with the first record from the client list on show

I am aware that ther are many better ways to do this but I am a complete novice and this particular way will do for now

Any help wold be greatly appreciated

Thanks in advancc

Malcolm
 
I'm assuming you're using the DoCmd.OpenForm method to open your edit form.
To do this, reference the value of the datasheet in the Click event of your
form:

DoCmd.OpenForm "frmJobDetails", , , "lngJobDetailID=" &
Forms!frmJobs.ctlJobDetails!lngJobDetailID, , acDialog

This is taken from a project I'm working on ... the datasheet in question is
actually a subform, hence the odd syntax. The "lngJobDetailID etcetc" is in
the Where argument of the DoCmd.OpenForm method.

--
Scott McDaniel
CS Computer Software
Visual Basic - Access - Sql Server - ASP
Malcolm said:
Hi

I have a form (datasheet) containing a list of clients. The unique fied
is Client_ID. There are 2,400 clients. What I am trying to do is to open a
form by clicking on the Client_ID field. I can open the form easily enough
but I would like the form to be showing the record for the particular client
I selected from the datasheet. Currently, the form just opens with the
first record from the client list on show.
I am aware that ther are many better ways to do this but I am a complete
novice and this particular way will do for now.
 
Back
Top