G
Guest
First here's the problem that prompted the help:-
I've a table with a field lineamnt that is "required" and has a validation
rule >= 0.01. In my continuous sub form I use the Forms Error section to trap
error 3316 as follows:-
Case 3316
ans = MsgBox("Line amount is zero - Do you want this
allocation line removed?", vbYesNo)
Response = acDataErrContinue
If ans = vbYes Then
Me.Undo
DoCmd.GoToRecord , , acFirst
End If
Case Else
'Let access display it's default message
End Select
As you can see what I (well my users) want is to be able to automatically
remove the line if it's invalid. Using Undo almost works except when they
"blank" an amount on an already existing line. As far as I can tell you can't
use delete in the Forms Error section. So here's my questions:-
1. Any idea how to solve the immediate problem
2. Is there a nicer way to delete than
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
3. How can I make Access validation tidy. e.g. If it's mandatory data set
required in the table and trap in Form Error (which is what I was trying) or
perhaps always recalc before save (requery) - are they the same?
Thanks in anticipation for any particular help or general advice - John P.
I've a table with a field lineamnt that is "required" and has a validation
rule >= 0.01. In my continuous sub form I use the Forms Error section to trap
error 3316 as follows:-
Case 3316
ans = MsgBox("Line amount is zero - Do you want this
allocation line removed?", vbYesNo)
Response = acDataErrContinue
If ans = vbYes Then
Me.Undo
DoCmd.GoToRecord , , acFirst
End If
Case Else
'Let access display it's default message
End Select
As you can see what I (well my users) want is to be able to automatically
remove the line if it's invalid. Using Undo almost works except when they
"blank" an amount on an already existing line. As far as I can tell you can't
use delete in the Forms Error section. So here's my questions:-
1. Any idea how to solve the immediate problem
2. Is there a nicer way to delete than
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
3. How can I make Access validation tidy. e.g. If it's mandatory data set
required in the table and trap in Form Error (which is what I was trying) or
perhaps always recalc before save (requery) - are they the same?
Thanks in anticipation for any particular help or general advice - John P.