Automatic filling in a main form from a subform

johiot

New member
Local time
Today, 18:07
Joined
May 10, 2002
Messages
8
I have a main form “frmPatient”with the fields : PatientID, Name, Datein, DateOut,and DateDiff.
I have a subform “subformUseExams” with the fields “PatientID’’ and “Categoryname”(combobox)
In the afterupdate event of CategoryName I use this code:
Private Sub CategoryName_AfterUpdate ()
If IsNull(Forms!frmPatients!DateOut) Then Forms!frmPatients!DateOut = Date
EndSub
-I want the DateDiff value to be:[DateOut]-[Datein] and to fill automatically.
I tried in some ways but I couldn’t.
Any suggest?
 
I am not completely clear on what it is you want, based on your code, but maybe this is it...

Private Sub CategoryName_AfterUpdate ()
If IsNull(Forms!frmPatients!DateOut) Then
Forms!frmPatients!DateOut = Date
Else
Forms!frmPatients!DateDiff = DateDiff("d",Forms!frmPatients!DateOut,Forms!frmPatients!DateIn)
EndSub
 

Users who are viewing this thread

Back
Top Bottom