S
Steve Schapel
Shep,
I think this design is going to make life difficult for you. I would
strongly recommend that you just have one field in the tblPatientV1
table that uniquely identifies each patient. This field should be the
Primary Key field in the tblPatientV1 table, and also used as the
Foreign Key field in tables that are related to tblPatientV1, such as
the tblAppointmentsV1 table. If I understand you correctly, the
ChartNumber could fulfil this function, so you can scrap the ID field
from the tblPatientV1 table altogether. I am not sure what data you
have in the Patient table, but if this is the patient's name, it is not
guaranteed to be unique, and as such should not be used to relate
tables, or to relate subforms to main forms, etc.
I know we have strayed somewhat from your original question. If we go
back there, I think adapting the code I gave you to the following will
probably work in this instance... but the above point about revising the
table and form design still applies.
If Me.ApptKept And Me.IniVisit Then
CurrentDb.Execute "UPDATE tblPatientV1" & _
" SET [Initial Visit] = #" & Me.ApptDate & "#" & _
" WHERE ChartNumber='" & Me.ChartNumber & "'",
dbFailOnError
End If
I think this design is going to make life difficult for you. I would
strongly recommend that you just have one field in the tblPatientV1
table that uniquely identifies each patient. This field should be the
Primary Key field in the tblPatientV1 table, and also used as the
Foreign Key field in tables that are related to tblPatientV1, such as
the tblAppointmentsV1 table. If I understand you correctly, the
ChartNumber could fulfil this function, so you can scrap the ID field
from the tblPatientV1 table altogether. I am not sure what data you
have in the Patient table, but if this is the patient's name, it is not
guaranteed to be unique, and as such should not be used to relate
tables, or to relate subforms to main forms, etc.
I know we have strayed somewhat from your original question. If we go
back there, I think adapting the code I gave you to the following will
probably work in this instance... but the above point about revising the
table and form design still applies.
If Me.ApptKept And Me.IniVisit Then
CurrentDb.Execute "UPDATE tblPatientV1" & _
" SET [Initial Visit] = #" & Me.ApptDate & "#" & _
" WHERE ChartNumber='" & Me.ChartNumber & "'",
dbFailOnError
End If