Limiting user error (1 Viewer)

D

D B Lawson

Guest
I have a subform in datasheet view in which the user has to select an issue from a combo box. They then have to categorise the issue by selecting M, A or SO, through a list box. They are only allowed one M issue per entry but can have multipal A or SO entries. Is there anyway of stopping them entering M more than once? The issues subform is linked to the main form by a reference number.

Hope this is clear.
 

Travis

Registered User.
Local time
Today, 14:04
Joined
Dec 17, 1999
Messages
1,332
Try this:

On the subform

on the BeforeUpdate of the 'categorise the issue' Field add this code.

Private Sub Categorise_The_Issue_BeforeUpdate(Cancel as Integer)
dim rst as recordset
if me.recordsetclone.RecordCount<>0 then
set rst = me.RecordsetClone
rst.moveFirst
do while not rst.EOF
if rst.Fields("CategoriseTheIssue") = "M" then
msgbox "You have already used M."
Cancel = True
me.[Catergorise_The_Issue].Undo
Exit Sub
end if
rst.movenext
Loop
set rst = nothing
End if

End Sub
 
D

D B Lawson

Guest
Thanks, this is working in part. However, once I select "M" once, it is then stopping me from selecting either "A" of "SO" for subsequent issues and categories relevant to the same recordset.

What else would I need to add?

[This message has been edited by D B Lawson (edited 01-25-2000).]

[This message has been edited by D B Lawson (edited 01-25-2000).]
 

Users who are viewing this thread

Top Bottom