Able to fill data once, and then show/write to other forms and tables ?

B

Bibi

Hello

I have the following 2 questions. On a "start"-form a
specific patient number needs to be filled in.

1) This patient number then should show on every following
form that needs to be filled in for that patient.

2) This patient number needs not only to be saved in the
table that is the underlying table for the start-form, but
also in every other table where this variable occurs
(which is pretty much every table).

How can I do both things ?
 
G

Gerald Stanley

I would go about this by creating a module to contain the
Public variable for holding the patient id e.g.
Public gintPatientId As Integer
Obviously you will need to change this depending upon the
data type of the id.

Then in your start form, I would populate this variable in
the AfterUpdate eventhandler of the control e.g.
gintPatientId = Me.txtPatientId
You should probably include some validation beforehand to
ensure that the user enters the PatientId in the correct
format.

Finally, in every subsequent data entry form, I would
populate the patientId control in the form's Load
eventhandler e.g.
Me.txtPatientId = gintPatientId

If you need to pull up the patient's details on any
subsequent form, you can use the variable within the filter
parameter of DoCmd.OpenForm e.g.
DoCmd.OpenForm "anotherForm",,, "studentId = " & gintStudentId

Hope This Helps
Gerald Stanley MCSD
 

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