Abort the not in list event if a condition is true

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

im using a not in list event that i want to abort if the following condition is true

If Len(Me.textbox & "") <> 9 The

MsgBox "Warning - too few digitis enteredr!
Cancel = Tru

It dosent seem to work when i use this direct in my not in list event. The not in list event triggers a sql that inserts a value in my "Selskap" table. All values included in this are text.

Any ideas?

Eri
 
Erik,

What is not working? Is the text being added regardless? Just a guess, but
have you tried using "NewData" instead of the control name?

'untested
If Len(NewData & "")<>9 Then
Response = acDataErrContinue
MsgBox "Warning - too few digits entered!"
Me.Undo
Else
'your sql here
End If

HTH,
Jeff


Erik said:
Hi,

im using a not in list event that i want to abort if the following condition is true:

If Len(Me.textbox & "") <> 9 Then

MsgBox "Warning - too few digitis enteredr!"
Cancel = True

It dosent seem to work when i use this direct in my not in list event. The
not in list event triggers a sql that inserts a value in my "Selskap" table.
All values included in this are text.
 
Back
Top