Results 1 to 11 of 11
  1. #1
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Permissions (Access 2000)

    Following on from <!post=JohnHutchinson's post 314789,314789>JohnHutchinson's post 314789<!/post> about SourceObject removal. I found this tip very useful but it has produced an unwanted side effect. My database is accessed by some users with Read-Only Users privileges. If you are one of these users, attaching subforms in an OnChange event a run-time 2614 error 'you don't have permission to insert this form inot another form'. Does anyone know how I can sort this? I don't want to give the Read-Only group design privilege to the master form or any subforms if I can help it.

    TIA
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Permissions (Access 2000)

    I haven't really tested this, but you might experiment to see if the following works:
    - Set the Source Object for all subforms in design view.
    - Open each of the subforms from the database window in design view, note the Record Source property, then clear this property.
    - In the On Change event of the tab control on the main form, set the Record Source property of the subform instead of the Source Object.

    ...
    If Me.sbfSubform.Form.RecordSource = "" Then
    Me.sbfSubform.Form.RecordSource = "whatever"
    End If

    Replace "whatever" by the record source you noted earlier.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Permissions (Access 2000)

    How are you creating "read-only" users? If you're using Access security, it shouldn't be a problem, since the code behind the forms can still function in that situation. Without seeing exactly what you're doing, I'm just guessing.

    John is talking about setting up your subforms and then removing the sourceobject property from the subform control on the parent form. In the OnChange event of the tab control, you determine which page has been selected, check to see if the subform control's sourceobject is an empty string, and if it is, insert the name of the actual source object. The delay is in the initial load of the form and the subforms. Once a sourceobject has been set, you don't need to remove it unless you are using a single subform control and merely changing the source object based on which subform you should be seeing. I've done it both ways effectively, but if you have very elaborate subforms with large recordsets, it could be faster to use separate subform controls and simply set their sourceobject the first time that tab is selected. You needn't remove the sourceobject again, since the form is saved without sourceobjects in the subforms. If you have a subform on the first tab, you'll want to load at form load or you'll see a white box in the middle of your tab page until the subform is populated.
    Charlotte

  4. #4
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permissions (Access 2000)

    Hans

    Thanks for that. I need to spend some time trying this out.

    Mark

  5. #5
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permissions (Access 2000)

    Charlotte

    The Read Only users are assigned with Access security. The OnChange event seems to try to change the design, something this security group can't do - or am I missing something? The group has open/run permissions and clicking a tab pops up this error:

    <IMG SRC=http://www.sparky99.demon.co.uk/images/accesserror.jpg>

    Here's the code snippet from the OnChange event...

    <pre>Select Case IntTabPage
    Case Is = 0
    strTabName = "Personal Details"
    Case Is = 1
    strTabName = "Financial Details"
    If Me.frmRatesSub.SourceObject = "" Then
    Me.frmRatesSub.SourceObject = "frmRatesSub"
    End If
    Case Is = 2
    strTabName = "Qualifications"
    If Me.frmQualsSub.SourceObject = "" Then
    Me.frmQualsSub.SourceObject = "frmQualsSub"
    End If
    Case Is = 3
    strTabName = "More Qualifications"
    If Me.frmOtherQualsSub.SourceObject = "" Then
    Me.frmOtherQualsSub.SourceObject = "frmOtherQualsSub"
    End If
    Case Is = 4
    strTabName = "Skills"
    If Me.frmSkillsSub.SourceObject = "" Then
    Me.frmSkillsSub.SourceObject = "frmSkillsSub"
    End If
    Case Is = 5
    strTabName = "Site Induction"
    Case Is = 6
    strTabName = "Contract Details"
    If Me.frmContractsSub.SourceObject = "" Then
    Me.frmContractsSub.SourceObject = "frmContractsSub"
    End If
    Case Is = 7
    strTabName = "Emergency Contact Details"
    Case Is = 8
    strTabName = "Kit"
    If Me.frmKitsSub.SourceObject = "" Then
    Me.frmKitsSub.SourceObject = "frmKitsSub"
    End If
    Case Is = 9
    strTabName = "Absence"
    If Me.frmAbsenceTaken.SourceObject = "" Then
    Me.frmAbsenceTaken.SourceObject = "frmAbsenceTaken"
    End If
    Case Is = 10
    strTabName = "Annual Leave"
    If Me.frmHolidaysTaken.SourceObject = "" Then
    Me.frmHolidaysTaken.SourceObject = "frmHolidaysTaken"
    End If
    If Me.frmLieuDaysEarned.SourceObject = "" Then
    Me.frmLieuDaysEarned.SourceObject = "frmLieuDaysEarned"
    End If
    If Me.frmLieuDaysTaken.SourceObject = "" Then
    Me.frmLieuDaysTaken.SourceObject = "frmLieuDaysTaken"
    End If
    Case Is = 11
    strTabName = "Applicant Skills"
    If Me.Applicants.SourceObject = "" Then
    Me.Applicants.SourceObject = "frmApplicants"
    End If
    Case Else
    strTabName = "Other tab viewed"
    End Select</pre>



    Permissions issues aside, the SourceObject trick works just fine. I do have a couple of subforms on the first tab and these load at form load.

    I've been trying Hans' suggestion but I'm running into all sorts of problems due to code embedded in some of the subforms. Seems that if the subform has no recordsource at form load and code for that form tries to reference a control that isn't there it throws a fit. I'm still looking into it.

    Mark

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Permissions (Access 2000)

    A bit more detail on your design may help us understand your problem better. Are you using a single subform control on the main form and simply changing the source object, or do you have multiple subforms on different tabs? Also, what control are you using to trigger your OnChange event? Finally do you have code in the subforms that runs at Load or Open events? (If you do, events work differently on a subform than they do on a main form.)
    Wendell

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Permissions (Access 2000)

    Open/Run is what we use for our read only users and we don't have a problem with setting source objects. I use code like this all the time:

    If Len(Me.fsbDailyOperations.SourceObject) = 0 Then
    Me.fsbDailyOperations.SourceObject = "fsbDailyOperations"
    End If

    You can run into problems if the Master and Child link fields aren't already filled in, though.
    Charlotte

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Permissions (Access 2000)

    I have just revisited the project where I was setting the SourceObject in the Onchange event of the tab control. I also have a group of ReadOnly users, and don't have any problems with permissions.

    In your Select Case statement, at each step as well as setting the SourceObject, you also set a value for a string variable:
    strTabName = "Financial Details"

    What do you do with this string variable?
    Regards
    John



  9. #9
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permissions (Access 2000)

    Charlotte

    Hmm... curious. I'll check the Master Child links and report back

    Mark

  10. #10
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permissions (Access 2000)

    Wendell

    The main form has a tab control with 10 tabs. Each tab has one or more subforms (one or two don't have any). Most but not all of these subforms have have code but not in the load/open/current events. No subform control calls more than than one subform, I'm not using the SourceObject for that. The code in the subforms is usually in the OnEnter. BeforeUpdate, AfterUpdate events for fields on the subform (this, incidentally, is what seems to causing the problems with Hans' recordsource solution). The Onchange event is on the tab control.

    Mark

  11. #11
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permissions (Access 2000)

    John

    The string variable just sets the tab page name. It was done that way because I was going to have the same page doing different things for different users. As it has turned out I haven't done it. so I could do away with it altogether and set it at design time.

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •