Setting value

Bruce75

Psychologist
Local time
Today, 12:30
Joined
Sep 29, 2004
Messages
46
Hi

Many thanks in advance

I have a form with 3 subforms on tabs. On the individualtreatment subform, the user can enter a date as a startdate for therapy. The user is then asked if they want to remove the patient from the appropriate waiting list (triggered in the after update). The idea is, that if they say yes, the focus goes to the waiting list tab, then the start date for therapy that they entered is copied to the offwaiting list date (thus removing the patient from the waiting list).

I have managed to get the focus to switch to the waitinglist tab. I have set the variable therapystart to equal the start date of the therapy. I have set therapytype as a variable to equal the type of therapy that the user has just entered a start date for. I have then tried to use the FindRecord command to find a matching therapy in the waiting list subform, but this does not seem to be working properly. I am also having trouble copying the startdate to the off waiting list date.

Please help!

Here is what I have so far:

Private Sub StartDate_AfterUpdate()
Dim starttherapy As Variant
Dim therapytype As Variant
Dim UResponse As Integer
starttherapy = Me!startdate
therapytype = Me!Type_of_Treatment
UResponse = MsgBox("Do you want to remove the patient from the appropriate waiting list?", vbYesNo, "Go to waiting list?")

If UResponse = vbYes Then

MsgBox (starttherapy)
MsgBox (therapytype)
Forms![frm_patientdetails].SetFocus

Forms!frm_patientdetails.Form!tc.Pages("Waiting Lists").SetFocus
Forms!frm_patientdetails.Form!sf_jun_waitinglist.SetFocus
therapywaitb = Forms!frm_patientdetails!sf_jun_waitinglist.Form!Waitingfor
MsgBox (therapywaitb)
DoCmd.FindRecord therapytype, acEntire, False, acDown, , acCurrent, True
therapywait = Forms!frm_patientdetails!sf_jun_waitinglist.Form!Waitingfor
MsgBox (therapywait)
MsgBox (starttherapy)


Else

Cheers,

Bruce
 
Hi Bruce,
The form that displays the waiting list is based on a table/query. Why not just use an update query to modify that table instead of trying to go through the form manipulations?
 
thanks, that works nicely and is much more simple than what i was trying to do.

Bruce
 

Users who are viewing this thread

Back
Top Bottom