Reference to control LinkChild and LinkMaster

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,

Unfortunatelly I am stuck again..

I have a multipage contol in a access form... following tables I got..

tblKunden kunID Primary Key
tblObjekte objID Primary Key objKunIDRef ForeingKey to tblKunden
tblObjMitarbeiter objMID Primary Key objMObjIDRef foreignkey to tblObjekt

I have a code wich works fine and reference to the kunID but when I like to reference tblObjMitarbeiter to tblObject I can not make it work.


Here is the code I am useing...

Code:
    With Me.sfmDetails
        On Error Resume Next
        .SourceObject = ""
        .LinkChildFields = ""
        .LinkMasterFields = "kunID"
        On Error GoTo 0
        
        Select Case Me.mpgDaten.Value
        Case Me.pagKunden.PageIndex
           .SourceObject = "frmKundenDetails"
           .LinkChildFields = "kunID"
            
        Case Me.pagObjekte.PageIndex
            .SourceObject = "frmObjektKunden"
            .LinkChildFields = "objKunIDRef"
            
[COLOR=#ff0000]        Case Me.pagObjStunden.PageIndex
            .SourceObject = "frmObjMitarbeiter"
            .LinkMasterFields = "objID"
            .LinkChildFields = "objMObjIDRef"[/COLOR]

            
        Case Else
as the .LinkMasterField is not kunID I have troubles to reference it correctly..

In a multipage I got only one control ("Subform") which gets its values from the code above..
The code in red is not working and I am not quite sure how to reference it correctly..
I hope you guys understand what I am after and can help me with this.

Many thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I'll take a few guesses.
- You've wrapped all of this in a With block, so WITH an object (sfmDetails) on Me (the parent form) you are trying to set a property to an item that can't be found
- in the 3rd case, the reference is to a subform and the first two are not, which would mean your reference to the subform is incomplete
- in the 3rd case, the source object is not loaded
- there is a difference in spelling between your code and the actual name of an object

Do you get any error message? Have you tried stepping through the code and verified the existence and/or values of things upon the execution of each line of code?
Gotta say I'm not a fan of including a whole lot of stuff in a With block that doesn't apply to the object at hand.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top