Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Changing subforms via VBA problem

$
0
0
Using a group box (gruppevalg) I'm giving the user the ability to choose between different contents in a subform.

When changing to either value 1 and 2, I don't get any error.

Changing to 3 doesn't either, but going from value 3 to 1 I get a prompt for a parameter, and then exits with errorcode 2101 + "..... isn't valid for this property".

I have similar code on a few other forms, and they work flawlessly.

Any ideas?

Cheers, Trin

Code:

    If gruppevalg.Value = 1 Then
        With Forms!arbejdsgiver!underform_arbejdsgiver
            .SourceObject = "Stilling_liste"
            .LinkChildFields = "Stilling_arbejdsgiverid"
            .LinkMasterFields = "Arbejdsgiver_id"
        End With
    ElseIf gruppevalg.Value = 2 Then
        With Forms!arbejdsgiver!underform_arbejdsgiver
            .SourceObject = "Arbejdsgiver_forloebshistorik"
            .LinkChildFields = "Arbejdsgiver_id"
            .LinkMasterFields = "Arbejdsgiver_id"
        End With
    ElseIf gruppevalg.Value = 3 Then
        With Forms!arbejdsgiver!underform_arbejdsgiver
            .SourceObject = "Arbejdsgiver_kontaktpersoner"
            .LinkChildFields = "Arbejdsgiverkontakt_arbejdsgiver"
            .LinkMasterFields = "Arbejdsgiver_id"
        End With
    ElseIf gruppevalg.Value = 4 Then
        With Forms!arbejdsgiver!underform_arbejdsgiver
            .SourceObject = "Arbejdsgiver_kontakthistorik"
            .LinkChildFields = "Arbejdsgiverkontakt_arbejdsgiverid"
            .LinkMasterFields = "Arbejdsgiver_id"
        End With
    Else
            MsgBox "dyt else", vbOKOnly
    End If


Viewing all articles
Browse latest Browse all 13329

Trending Articles