C
Charlie.Mitchell
I have a form named, lets say "a"
And a subform in it named "b"
form a is assigned to table "c"
form b is assigned to table "d"
Table "c" has a field named "bob"
What I want to do is if, "bob" = "x" the only allow the one entry in subform
b and display message only one entry allowed.
I started the following with the real names:
Private Sub Form_BeforeInsert(Cancel As Integer) ' This goes in subform "b"
If Me.CurrentRecord = 2 And Forms![a].[bob] = "x" ' This is OK
Then
'??????????????????????????????????????
Cancel = True 'This is where I am making
a mistake???????????????????????????????????????
MsgBox "You can only have one invoice per bob entry", vbInformation,
"Data Error"
End If
'From here I want to go back to the form as if I only have
one entry now and sitting as if I just called it up.
End Sub
Thanks
Charlie
And a subform in it named "b"
form a is assigned to table "c"
form b is assigned to table "d"
Table "c" has a field named "bob"
What I want to do is if, "bob" = "x" the only allow the one entry in subform
b and display message only one entry allowed.
I started the following with the real names:
Private Sub Form_BeforeInsert(Cancel As Integer) ' This goes in subform "b"
If Me.CurrentRecord = 2 And Forms![a].[bob] = "x" ' This is OK
Then
'??????????????????????????????????????
Cancel = True 'This is where I am making
a mistake???????????????????????????????????????
MsgBox "You can only have one invoice per bob entry", vbInformation,
"Data Error"
End If
'From here I want to go back to the form as if I only have
one entry now and sitting as if I just called it up.
End Sub
Thanks
Charlie