Prev: acanywhere vs acentire
Next: datestamp with a check box
From: johnlute on 26 Jan 2010 08:45 Win2000 and Access 2003 I recently fixed the clutter of my form designs by going to a single subform control and a tab control. The subform has a null source object value which then gets loaded via the tab control's OnChange Event: Private Sub TabCtl_Change() If Me.Dirty Then Me.Dirty = False Select Case Me.TabCtl Case 0 Me.sfrmCtl.Visible = False Case 1 Me.sfrmCtl.Visible = True Me.sfrmCtl.SourceObject = "sfrmLocationsLocationIDs" Me.sfrmCtl.LinkMasterFields = "txtLocationID" Me.sfrmCtl.LinkChildFields = "txtLocationID" Case 2 Me.sfrmCtl.Visible = True Me.sfrmCtl.SourceObject = "sfrmFacilitiesLocsContactIDs" Me.sfrmCtl.LinkMasterFields = "txtLocationID" Me.sfrmCtl.LinkChildFields = "txtLocationID" Case 3 Me.sfrmCtl.Visible = True Me.sfrmCtl.SourceObject = "sfrmFacilitiesProfiles" Me.sfrmCtl.LinkMasterFields = "numLocationAddressID" Me.sfrmCtl.LinkChildFields = "numLocationAddressID" Case 4 Me.sfrmCtl.Visible = True Me.sfrmCtl.SourceObject = "sfrmLocationsWebsites" Me.sfrmCtl.LinkMasterFields = "txtLocationID" Me.sfrmCtl.LinkChildFields = "txtLocationID" Case 5 Me.sfrmCtl.Visible = True Me.sfrmCtl.SourceObject = "sfrmLocationsAttachments" Me.sfrmCtl.LinkMasterFields = "txtLocationID" Me.sfrmCtl.LinkChildFields = "txtLocationID" End Select End Sub This works fine as long as the user has write permissions to the database design. For all other users the code fails to fire. Does anyone have any ideas how to resolve this? Thanks!
From: Stefan Hoffmann on 26 Jan 2010 09:06 hi John, On 26.01.2010 14:45, johnlute wrote: > This works fine as long as the user has write permissions to the > database design. For all other users the code fails to fire. Can you define "fails to fire"? > Does anyone have any ideas how to resolve this? Imho you need to set the LinkChildFields before LinkMasterFields. mfG --> stefan <--
From: johnlute on 26 Jan 2010 09:37 Thanks for the reply, Stefan. > Can you define "fails to fire"? The subform displays as a blank, white, rectangle. The proper subform isn't loaded. > Imho you need to set the LinkChildFields before LinkMasterFields. I'll check into that - it may be part of the problem however it's *got* to be primarily because the user hasn't any write permissions to the design. When I log into the database then it behaves. When a data user logs in then it decides to do otherwise.
From: Stefan Hoffmann on 26 Jan 2010 09:47 hi John, On 26.01.2010 15:37, johnlute wrote: > I'll check into that - it may be part of the problem however it's > *got* to be primarily because the user hasn't any write permissions to > the design. When I log into the database then it behaves. When a data > user logs in then it decides to do otherwise. No, this should not be the problem. I've used this function in *.mde's without problem: Public Sub FormSetSubForm(ASubForm As Access.SubForm, _ ASourceObject As String, _ ALinkChildFields As String, _ ALinkMasterFields As String, _ Optional ALinkMasterChild As Boolean = True) On Local Error GoTo LocalError If ASubForm.SourceObject <> ASourceObject Then _ ASubForm.SourceObject = ASourceObject If ALinkMasterChild Then If ASubForm.LinkChildFields <> ALinkChildFields Then _ ASubForm.LinkChildFields = ALinkChildFields If ASubForm.LinkMasterFields <> ALinkMasterFields Then _ ASubForm.LinkMasterFields = ALinkMasterFields Else If ASubForm.LinkChildFields <> "" Then _ ASubForm.LinkChildFields = "" If ASubForm.LinkMasterFields <> "" Then _ ASubForm.LinkMasterFields = "" End If Exit Sub LocalError: FormErrMsgBox "Fehler beim Zuweisen des Unterformulars '" & _ ASubForm.Name & "'." End Sub mfG --> stefan <--
From: johnlute on 26 Jan 2010 09:48
Stefan, > Imho you need to set the LinkChildFields before LinkMasterFields. I gave that a quick check and set the Child first - yikes. It completely frustrated things and the subform wouldn't load properly at all. I have to take this out of the equation. |