|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how do duplicate a field's value and increment another's
i have an a2k application and a form having two controls which make up the PK.
a) Patient Number b) Lesion Number the form is 'filtered' so when user designates a patient number to work on from another open form, he's taken to this one and can view only those PNs selected. there are multiple records viewable on this form (it's coninuous) each one having an incrementally larger value of "Lestion Number" (from 1,2,....,12) i wrote some vba to do that; as shown below in the following attempt, when a form is loading, the value of the Patient Number is gotten from a form called "RECIST Disease Evaluation: Nontarget Lesions" Private Sub Form_Load() LAS_EnableSecurity Me Me.Patient_Number.Value = Forms![RECIST Disease Evaluation: Nontarget Lesions]![Patient Number] End Sub how can i let user simultaneously duplicate a Patient Number and increment a Lesion Number w/o having to do so manually. Private Sub Patient_Number_AfterUpdate() Me.Patient_Number.DefaultValue = "'" & [Patient Number] & "'" ' that's a single quote within doubles and this line is intended to take care of duplicating the Patient Number Me.Lesion_Number = IIf(IsNull("[Lesion Number]"), 1, 1 + DMax("[Lesion Number]", "Lesions: Non-Target", "[Patient Number] = " & Me[Patient Number])) ' this should handle the case of incrementing the value of Lesion Number (1,2,3,...,10) If Me![Lesion Number] > 10 Then RetValue = MsgBox("Delete any records exceeding the upper limit", vbInformation) End If DoCmd.Requery End Sub the above intended to duplicate the value of Patient Number and increment Lesion Number. things aren't working though -- no error messages just not working. has anyone tried to deal with this question? |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > how do duplicate a field's value and increment another's |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|