Hi all,
I have tried error trapping a field, whereby if the value of [field2] does
not match [field1] then it should exit sub and stay there for correction.
It (A2K) don't want to do that, and currently I am having to use the
'gotFocus' event of the next field [field3] to force it back to [field2]!
<basic code snippet... Events... on dirty = true, or AfterUpdate, or Exit>
If me.[field2] <> me.[field1] Then
msgbox "yada yada.", vbInformation
me.[field2].setfocus
Exit Sub
End if
</snippet>
The dang thing moves to [field3] regardless, so at the mo I have [field3]
checking the same values, and...
<snip2>
Private Sub Field3_gotfocus()
If me.[field2] <> me.[field1] Then
me.[field2].setfocus
End If
</snip2>
Code above is not copied direct from the event, hence the irregularities
with me and Me instances.... but it hopefully gives the general idea of what
I am trying to achieve...
Is there any reason why the focus cannot stay with [field2]?
your list's own 17th century goat-herder,
DubboPete
tina - 30 Mar 2005 11:12 GMT
try adding the validation to the control's BeforeUpdate event, as
Private Sub Field2_BeforeUpdate(Cancel As Integer)
If Not (Me!Field2 = Me!Field1) Then
msgbox "yada yada.", vbInformation
Cancel = True
End If
End Sub
hth
> Hi all,
>
[quoted text clipped - 31 lines]
> your list's own 17th century goat-herder,
> DubboPete
DubboPete - 30 Mar 2005 11:14 GMT
thanks Tina,
will keep u informed when I get back to work in the morning, and i get to
try it...
Pete the goat herder
> try adding the validation to the control's BeforeUpdate event, as
>
[quoted text clipped - 47 lines]
>> your list's own 17th century goat-herder,
>> DubboPete
DubboPete - 31 Mar 2005 07:43 GMT
worked fine Tina,
thanks for your help
Pete
> try adding the validation to the control's BeforeUpdate event, as
>
[quoted text clipped - 47 lines]
>> your list's own 17th century goat-herder,
>> DubboPete