W
wd1153
Hi all
-I have two tables, 1) tblPatient 2) tblVisits.
-I made a Tabform with 2 tabs, one for tblPatient, and
the other for tblVisits.
- the relation between tblPatient and tblVisits is One-To-
Many.
-on the form head, I have a text serach box and a button.
- what I am trying to achieve is to have the user type in
the PatientID in the search box, after click on the
button, the tblPatient tab will show that patient's
information. If I switch to Visit tab, it should show the
visit that particular patient had made.
-My problem: All records are loaded as planned, But I
could not add new record on Visit tab. Because the record
source for the visit tab is load on TabChange() event as
following:
*************************************************
Private Sub tabData_Change()
Select Case Me.tabData.Pages.Item(Me.tabData.Value).Name
Case "pagPatient"
Me.fsubEDVisit.Visible = False
Me.fsubReferral.Visible = False
Case "pagEDVisit"
Debug.Print txtMHID
Me.fsubEDVisit.Form.RecordSource = "QryEDVisit"
Me.fsubEDVisit.Controls
("lstRiskFactorAvailable").Requery
Me.fsubEDVisit.Visible = True
******************************************************
Alos the Search button click event handler is as following:
*************************************************
Private Sub cmdSearch_Click()
On Error GoTo Err_handler
Me.tabData.Pages("pagPatient").SetFocus
Me.fsubEDVisit.Form.RecordSource = ""
Me.Requery
Exit_Here:
Exit Sub
Err_handler:
MsgBox Err.Description
Resume Exit_Here
End Sub
******************************************************
-the record source property for the pagPatient (main) is
set at the design time, and it is a query base on the
search text info as following:
SELECT tblPatients.MHID, tblPatients.LastName,
tblPatients.FirstName, tblPatients.Race,
tblPatients.MaritalStatus, tblPatients.Gender,
tblPatients.Street, tblPatients.City, tblPatients.State,
tblPatients.Zip, tblPatients.Phone, tblPatients.BDay,
tblPatients.LivingArrangement, tblPatients.LivingSituation
FROM tblPatients
WHERE (((tblPatients.MHID)=[forms]![frmPatient]!
[txtMHID]));
-the record source for the pagEDVisit is also based on a
query as following(qryEDVisit):
SELECT tblEDVisits.PTID, tblEDVisits.EDVisitDate,
tblEDVisits.PrimaryMD, tblEDVisits.ChiefComplaint,
tblEDVisits.Falls, tblEDVisits.MemoryProblem,
tblEDVisits.KnowDate, tblEDVisits.InfoSource,
tblEDVisits.CNSAdmit, tblEDVisits.DataCompleteDate,
tblEDVisits.MHID
FROM tblPatients INNER JOIN tblEDVisits ON
tblPatients.MHID = tblEDVisits.MHID
WHERE (((tblEDVisits.MHID)=[forms]![frmPatient]!
[txtMHID]));
How would I be able to make the pagEDVisit to take new
record. Many thanks
-I have two tables, 1) tblPatient 2) tblVisits.
-I made a Tabform with 2 tabs, one for tblPatient, and
the other for tblVisits.
- the relation between tblPatient and tblVisits is One-To-
Many.
-on the form head, I have a text serach box and a button.
- what I am trying to achieve is to have the user type in
the PatientID in the search box, after click on the
button, the tblPatient tab will show that patient's
information. If I switch to Visit tab, it should show the
visit that particular patient had made.
-My problem: All records are loaded as planned, But I
could not add new record on Visit tab. Because the record
source for the visit tab is load on TabChange() event as
following:
*************************************************
Private Sub tabData_Change()
Select Case Me.tabData.Pages.Item(Me.tabData.Value).Name
Case "pagPatient"
Me.fsubEDVisit.Visible = False
Me.fsubReferral.Visible = False
Case "pagEDVisit"
Debug.Print txtMHID
Me.fsubEDVisit.Form.RecordSource = "QryEDVisit"
Me.fsubEDVisit.Controls
("lstRiskFactorAvailable").Requery
Me.fsubEDVisit.Visible = True
******************************************************
Alos the Search button click event handler is as following:
*************************************************
Private Sub cmdSearch_Click()
On Error GoTo Err_handler
Me.tabData.Pages("pagPatient").SetFocus
Me.fsubEDVisit.Form.RecordSource = ""
Me.Requery
Exit_Here:
Exit Sub
Err_handler:
MsgBox Err.Description
Resume Exit_Here
End Sub
******************************************************
-the record source property for the pagPatient (main) is
set at the design time, and it is a query base on the
search text info as following:
SELECT tblPatients.MHID, tblPatients.LastName,
tblPatients.FirstName, tblPatients.Race,
tblPatients.MaritalStatus, tblPatients.Gender,
tblPatients.Street, tblPatients.City, tblPatients.State,
tblPatients.Zip, tblPatients.Phone, tblPatients.BDay,
tblPatients.LivingArrangement, tblPatients.LivingSituation
FROM tblPatients
WHERE (((tblPatients.MHID)=[forms]![frmPatient]!
[txtMHID]));
-the record source for the pagEDVisit is also based on a
query as following(qryEDVisit):
SELECT tblEDVisits.PTID, tblEDVisits.EDVisitDate,
tblEDVisits.PrimaryMD, tblEDVisits.ChiefComplaint,
tblEDVisits.Falls, tblEDVisits.MemoryProblem,
tblEDVisits.KnowDate, tblEDVisits.InfoSource,
tblEDVisits.CNSAdmit, tblEDVisits.DataCompleteDate,
tblEDVisits.MHID
FROM tblPatients INNER JOIN tblEDVisits ON
tblPatients.MHID = tblEDVisits.MHID
WHERE (((tblEDVisits.MHID)=[forms]![frmPatient]!
[txtMHID]));
How would I be able to make the pagEDVisit to take new
record. Many thanks