error 2614 setting SourceObject

C

chris

A few weeks ago someone (actually TC) helped me with a db where I
wanted to use user level security permissions in a form with subforms
on different tabs. He suggested me to test if a user can set the
sourceobject property of a subform. If he cannot (because he doesn't
have permissions on the subform) the corresponding tab is disabled.

(original thread: http://groups.google.be/groups?hl=n...22&meta=group%3Dmicrosoft.public.access.forms)

In code, I do something like

subForm1.SourceObject = subForm1.Tag
If Err.Number <> 0 Then
On Error GoTo 0
tabMain.Pages(4).Visible = False
End If


This works fine for the first subform. But when I repeat the code for
a second one, I get error 2614 "You dont have permission to insert
this form into another form". I don't think it has anything to do with
the particular subform because even if I invert the order of the 2
code snippets, it's always the second snippet that raises the error.
Does anyone have an idea why I'm getting this error?

tia,
Chris
 
D

Dirk Goldgar

chris said:
A few weeks ago someone (actually TC) helped me with a db where I
wanted to use user level security permissions in a form with subforms
on different tabs. He suggested me to test if a user can set the
sourceobject property of a subform. If he cannot (because he doesn't
have permissions on the subform) the corresponding tab is disabled.

(original thread:
http://groups.google.be/groups?hl=n...22&meta=group%3Dmicrosoft.public.access.forms)

In code, I do something like

subForm1.SourceObject = subForm1.Tag
If Err.Number <> 0 Then
On Error GoTo 0
tabMain.Pages(4).Visible = False
End If


This works fine for the first subform. But when I repeat the code for
a second one, I get error 2614 "You dont have permission to insert
this form into another form". I don't think it has anything to do with
the particular subform because even if I invert the order of the 2
code snippets, it's always the second snippet that raises the error.
Does anyone have an idea why I'm getting this error?

Before running that code snippet, you must have turned on in-line
error-handling with the statement

On Error Resume Next

But then, as part of your response when an error is raised, you restore
default error-handling:
On Error GoTo 0

I suspect that when you go to perform the test again for the next
subform, you fail to switch in-line error-handling again. If I'm right,
you need to execute another

On Error Resume Next

statement before the second block of code.
 
C

chris

Thanks a lot, this works fine!

Dirk Goldgar said:
Before running that code snippet, you must have turned on in-line
error-handling with the statement

On Error Resume Next

But then, as part of your response when an error is raised, you restore
default error-handling:


I suspect that when you go to perform the test again for the next
subform, you fail to switch in-line error-handling again. If I'm right,
you need to execute another

On Error Resume Next

statement before the second block of code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top