lynsey2
Registered User.
- Local time
- Today, 11:22
- Joined
- Jun 18, 2002
- Messages
- 439
hey there guy's! I've been trying to do this for ages and got so far now i dont have a clue! I have posted about this before but its kinda different so ill start over.
THE STORY
I need to be able to get the history of prescriptions for each patient, to do this i have a button on the create script form, this button takes you to a pop up form with 2 list boxes on it (the 1st so you can select the script e.g. the last one and the 2nd so you can select the drugs from the selected script one by one or select them all) after you have selected the drugs in the second list box i need them to fill out the fields in the create script form.
THE PROBLEM
list box 1 doesn't bring up scripts ONLY for the selected patient!
list box 2 has started having problems looking up drugs for the selected script!
when i select 1 drug from list box 2 it fills out the fields in create script but if i select another drug (say to prescribe 2 drugs) it overwrites the first one.
THE SET-UP
i have 3 tbls!
ARTScriptMaster
Ref:
Patient Number
Start Date
Doctor
Consultant
Stop Date
Weeks Surname Forename Address1 PostCode Dob drug1 form1 Frequency1 Strength1 drug2 form2 Frequency2 Strength2 drug3 form3 Frequency3 Strength3 drug4 form4 Frequency4 Strength4 drug5 form5 Frequency5 Strength5 drug6 form6 Frequency6 Strength6 drug7 form7 Frequency7 Strength7 otherdrug otherform otherfreq otherstrength otherdrug2 otherform2 otherfreq2 otherstrength2 otherdrug3 otherform3 otherfreq3 otherstrength3 Comments AttendGPsurgery FollowUp Been provided Are Recommended UsualARTchangedYES UsualARTchangedNO otherday1 otherday2 otherday3
his1
Ref Start Date Stop Date Doctor Consultant Comments
his2
Ref PatientNumber Drug Form Frequency Strength
list box 1 looks up his1 list box 2 looks up his2 depending on what is chosen in list box 1.
HERE IS THE CODE
Sub Reset_Text()
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.ControlType = acTextBox Then
ctrl.Value = Null
End If
Next ctrl
End Sub
Private Sub close_hist_Click()
On Error GoTo Err_close_hist_Click
DoCmd.Close
Exit_close_hist_Click:
Exit Sub
Err_close_hist_Click:
msgbox Err.Description
Resume Exit_close_hist_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
SelectDrugs.Enabled = False
SelectDrugs.RowSource = ""
SelectScript.DefaultValue = ""
End Sub
Private Sub SelectDrugs_Click()
Reset_Text
Dim Ref As Integer
Dim MyRS As DAO.Recordset
Dim MySearch As String
Set MyRS = CurrentDb.OpenRecordset("his2", dbOpenDynaset)
Ref = Me.SelectDrugs.Column(0)
MySearch = "[Ref]=" & Ref
MyRS.FindFirst MySearch
Forms!ARTScript!pickDrug1 = MyRS("Drug")
Forms!ARTScript!pickForm1 = MyRS("Form")
Forms!ARTScript!pickFrequency1 = MyRS("Frequency")
Forms!ARTScript!pickStrength1 = MyRS("Strength")
MyRS.Close
DoCmd.Close
End Sub
Private Sub SelectScript_Click()
Reset_Text
Me.SelectDrugs.RowSource = "SELECT DISTINCTROW his2.Ref, his2.PatientNumber, his2.Drug, his2.Form, his2.Frequency,his2.Strength FROM his2 WHERE (((his2.Ref)=" & SelectScript.Value & ")) ORDER BY his2.Ref DESC;"
Me.SelectDrugs.Requery
SelectDrugs.Enabled = True
End Sub
ANY HELP WILL BE MORE THAN APRECIATED REALLY REALLY APRECIATED THANKS IN ADVANCE!
THE STORY
I need to be able to get the history of prescriptions for each patient, to do this i have a button on the create script form, this button takes you to a pop up form with 2 list boxes on it (the 1st so you can select the script e.g. the last one and the 2nd so you can select the drugs from the selected script one by one or select them all) after you have selected the drugs in the second list box i need them to fill out the fields in the create script form.
THE PROBLEM
list box 1 doesn't bring up scripts ONLY for the selected patient!
list box 2 has started having problems looking up drugs for the selected script!
when i select 1 drug from list box 2 it fills out the fields in create script but if i select another drug (say to prescribe 2 drugs) it overwrites the first one.
THE SET-UP
i have 3 tbls!
ARTScriptMaster
Ref:
Patient Number
Start Date
Doctor
Consultant
Stop Date
Weeks Surname Forename Address1 PostCode Dob drug1 form1 Frequency1 Strength1 drug2 form2 Frequency2 Strength2 drug3 form3 Frequency3 Strength3 drug4 form4 Frequency4 Strength4 drug5 form5 Frequency5 Strength5 drug6 form6 Frequency6 Strength6 drug7 form7 Frequency7 Strength7 otherdrug otherform otherfreq otherstrength otherdrug2 otherform2 otherfreq2 otherstrength2 otherdrug3 otherform3 otherfreq3 otherstrength3 Comments AttendGPsurgery FollowUp Been provided Are Recommended UsualARTchangedYES UsualARTchangedNO otherday1 otherday2 otherday3
his1
Ref Start Date Stop Date Doctor Consultant Comments
his2
Ref PatientNumber Drug Form Frequency Strength
list box 1 looks up his1 list box 2 looks up his2 depending on what is chosen in list box 1.
HERE IS THE CODE
Sub Reset_Text()
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.ControlType = acTextBox Then
ctrl.Value = Null
End If
Next ctrl
End Sub
Private Sub close_hist_Click()
On Error GoTo Err_close_hist_Click
DoCmd.Close
Exit_close_hist_Click:
Exit Sub
Err_close_hist_Click:
msgbox Err.Description
Resume Exit_close_hist_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
SelectDrugs.Enabled = False
SelectDrugs.RowSource = ""
SelectScript.DefaultValue = ""
End Sub
Private Sub SelectDrugs_Click()
Reset_Text
Dim Ref As Integer
Dim MyRS As DAO.Recordset
Dim MySearch As String
Set MyRS = CurrentDb.OpenRecordset("his2", dbOpenDynaset)
Ref = Me.SelectDrugs.Column(0)
MySearch = "[Ref]=" & Ref
MyRS.FindFirst MySearch
Forms!ARTScript!pickDrug1 = MyRS("Drug")
Forms!ARTScript!pickForm1 = MyRS("Form")
Forms!ARTScript!pickFrequency1 = MyRS("Frequency")
Forms!ARTScript!pickStrength1 = MyRS("Strength")
MyRS.Close
DoCmd.Close
End Sub
Private Sub SelectScript_Click()
Reset_Text
Me.SelectDrugs.RowSource = "SELECT DISTINCTROW his2.Ref, his2.PatientNumber, his2.Drug, his2.Form, his2.Frequency,his2.Strength FROM his2 WHERE (((his2.Ref)=" & SelectScript.Value & ")) ORDER BY his2.Ref DESC;"
Me.SelectDrugs.Requery
SelectDrugs.Enabled = True
End Sub
ANY HELP WILL BE MORE THAN APRECIATED REALLY REALLY APRECIATED THANKS IN ADVANCE!