|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I will try and explain what I am trying to do. The example below is in a continuous subform Example: Has a planning meeting been held? Outcome Yes sales No The example above is what I am trying to prevent. If they enter no in the next row of a continuous subform I would like the record to be undone. This works if I put in another no (third row)by using the code below either in the afterupdate or change event. When I insert a breakpoint at the end of the code and insert me.refresh at the start the variables work how I want them to, but the undo doesn't. If I remove the refresh it works, but only on the third row. Does refresh act as commit so I can't undo the changes? code:--------------------------------------------------------------------------------Dim stincid As Long Dim lngTotal As Long Dim lngno As Long Dim lngyes As Long stincid = Nz(Me![PLN_INC_ID], 0) lngTotal = DCount("[pln_inc_id]", "adult_plan", "[pln_inc_id] =" & stincid) lngyes = DCount("[pln_inc_id]", "adult_plan", "[pln_inc_id] =" & stincid & "and [pln_meet] = 'Yes'") lngno = DCount("[pln_inc_id]", "adult_plan", "[pln_inc_id] =" & stincid & "and [pln_meet] = 'No'") If lngTotal = 1 Then MsgBox ("No Change") ElseIf Meet = "No" And lngyes > 0 And lngTotal > 1 Then Me.Undo Cancel = True MsgBox ("worked") ElseIf Meet = "Yes" And lngno > 0 And lngTotal > 1 Then Me.Undo Cancel = True MsgBox ("worked yes") End If-------------------------------------------------------------------------------- Thanks for any help. |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Validation in a subform |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|