|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
writing executable vba statements
i use a2k on a windows 2000 professional desktop.
i built an application a while back which my users have finally got 'round to testing and i want to go over one of the features i put together as part of a response to a 'wish list' from one. the same one wishes it would go one better..... the ingredients of the scenario go something like this: there is a main form with a nested sub-form. the main one's called 'Treatment and Toxicity' and the sub-form's called 'Adverse Events (child). the linking child fields are "Patient Number" and "Cycle". the linking master fields are "Patient Number" and "Current Cycle Number". there is a listbox on the subform which can be "Yes" or "No" which indicates whether the information coded for the patient on the current cycle continues into the next cycle. since these are adverse events in a clinical trial and the data are being captured for each of multiple numbers of cycles in the trial the patient goest through until he de-enrolls or finishes it, an adverse event (e.g. 'headache', etc. etc) have continue beyond the end of the current cycle. so, the data entry person asked if it'd be possible to automatically duplicate a lot of the information in the subsequent cycle which she entered for the patient's current cycle. the code i designed to do this is below: Private Sub Duplicate_Click() Dim Response As Integer ' pending pending Response = MsgBox("Before proceding to duplicate this record, verify that the top part of this form " & Chr(13) & _ "for this patient's next cycle (i.e., MR and Cycle) were already entered. If not, press 'Cancel', otherwise press 'OK'.", vbOKCancel + vbCritical + vbDefaultButton2, "Critical !") If Response = 1 Then With Me.RecordsetClone .AddNew ![Patient Number] = Me.Patient_Number ' ignore ![Cycle] = Me.Cycle + 1 ![Cycle] = Forms![Treatment and Toxicity].[Current Cycle Number] + 1 ![AE Description] = Me.AE_Description ![Subtype] = Me.Subtype ![Onset] = Me.Onset ![Grade] = Me.Grade ![Serious] = Me.Serious ![Attribution] = Me.Attribution ![Action] = Me.Action ![Outcome] = Me.Outcome ![DLT] = Me.DLT ![AER Filed] = Me.AER_Filed ![ContinuingEndCycle] = "No" ' the following is intended to add a comment in the Updates field ![Updates] = "On " & Now() & " , " & LAS_GetUserName() & " duplicated this patient's Cycle #" & Forms![Treatment and Toxicity].[Current Cycle Number] & " record." .Update Me.Bookmark = .LastModified End With Else End If End Sub according to this data entry person, it works like the proverbial charm. however, she's apparently gotten even lazier since i developed this and now wishes that there were some way that pressing a button would set off a series of events which would automatically populate the next cycle for the current patient whenever the listbox were 'Yes' without having to individualize the requests which she currently has to do. the 'Duplicate' command button on the subform is only 'active' when the value of the listbox (whose name is 'Continuing') is 'Yes' as a safety feature to minimize erroneously launching it. so the machinegun approach to this would involve somehow sending my code through the database for the current patient and current cycle, sifting through all records having a 'Yes' for Me.Continuing and performing the desired action. i'm waiting for the mis people to send their technician to try to repair the vba help documentation -- which could take quite a while -- so i figured i'd bring this up in this venue. anyone? |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > writing executable vba statements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|