Hello everybody!
I try to make a database for my surgery.
I have 2 tables: tblPatients (key; Patient ID) and tblVisitMain (key: VisitID) (one-to-many relationship)
I made a form that has my patients details (frmPatientsMain3 ) and a second form for patients’ visits (frmVisitMain3).
The second form (frmVisitMain3) is a form/subform which is made from ‘frmPatientsMain3’ and the subform ‘subformVisitMain3’ which contains data from ‘tblVisitMain3’. They are linked (master/child) by ‘patient ID’ key.
First, I tried to make a report (rptRecipe) in order to print the recipe for the current visit. The result was a report containing all Recipies from all visits and therefore I could not print a single recipe
Then, I made a form/subform (frmRecipe) as a recipe. This form is like frmVisitMain3 but it contains only the necessary details (surname, name, medication, date, etc)
The button that open frmRecipe contains this code
Private Sub Command129_Click()
On Error GoTo Err_Command129_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmrecipe"
stLinkCriteria = "[PatientID]=" & Me![PatientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command129_Click:
Exit Sub
Err_Command129_Click:
MsgBox Err.Description
Resume Exit_Command129_Click
End Sub
This button opens the frmRecipe for the current patient but it does not chose the current visit prescription and it prints all patient visits recipes.
Is there any way to print only current visit’s recipe?
(I did this in a strange way. From subformRecipy Properties- Data,- Recordsource- Query builder, I chose sort Descenting by VisitID. By this way when FrmRecipy opens it appears the last visit record. When I print I choose page1 and it prints the last recipe. But it is complicated)
Is there a way to print current recipe from OR REPORT frmVisitMain3???
P.S. You have already understood that I am rookie!