Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Unhappy Unanswered: change source object of subform

    hello again
    ok so my problem today is: i've got a combobox with employee's names in it. on selecting an employee, i want to change the source object of a subform on the same page. in my after update function i have the following code:

    If Me.Text0.Value = "Sharne Botha" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_DC"
    ElseIf Me.Text0.Value = "Johann Jane" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Con"
    ElseIf Me.Text0.Value = "Deon van Eyk" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Shift_Deon"
    ElseIf Me.Text0.Value = "Abraham Moses" Then
    Form_newInput.InputSub.SourceObject = Sub_Input_Shift_Abe
    ElseIf Me.Text0.Value = "Richard Plaatjies" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Shift_Rich"
    Else

    End If

    there is no error message. but the subform space just remains blank.
    pls help
    thanks again in advance

  2. #2
    Join Date
    Jan 2004
    Location
    Romania - Bucharest
    Posts
    50
    try an "Me.requery" after you update the subform source object.

  3. #3
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    Originally posted by marp
    try an "Me.requery" after you update the subform source object.

    thanks I've tried that, but it doesn't make a difference

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487

    Re: change source object of subform

    Originally posted by actionant
    hello again
    ok so my problem today is: i've got a combobox with employee's names in it. on selecting an employee, i want to change the source object of a subform on the same page. in my after update function i have the following code:

    If Me.Text0.Value = "Sharne Botha" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_DC"
    ElseIf Me.Text0.Value = "Johann Jane" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Con"
    ElseIf Me.Text0.Value = "Deon van Eyk" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Shift_Deon"
    ElseIf Me.Text0.Value = "Abraham Moses" Then
    Form_newInput.InputSub.SourceObject = Sub_Input_Shift_Abe No Quotes - Hope this is a type Error.
    ElseIf Me.Text0.Value = "Richard Plaatjies" Then
    Form_newInput.InputSub.SourceObject = "Sub_Input_Shift_Rich"
    Else

    End If

    there is no error message. but the subform space just remains blank.
    pls help
    thanks again in advance
    Try this.....
    Code:
    Dim tblStrg As String
    
    Select Case Me.Text0
        Case "Sharne Botha"
             tblStrg = "Sub_Input_DC"
        Case "Johann Jane"
            tblStrg = "Sub_Input_Con"
        Case "Deon van Eyk"
            tblStrg = "Sub_Input_Shift_Deon"
        Case "Abraham Moses"
           tblStrg = "Sub_Input_Shift_Abe"
        Case "Richard Plaatjies"
           tblStrg = "Sub_Input_Shift_Rich"
        Case Else
    
    End Select
    
    Form_newInput.InputSub.SourceObject = tblStrg
    Form_newInput.InputSub.Requery

  5. #5
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    still nothing

  6. #6
    Join Date
    Jan 2004
    Location
    Bratislava - Slovakia
    Posts
    3
    Try Me.Repaint

  7. #7
    Join Date
    Nov 2003
    Posts
    1,487
    Attach the database. Let's have a look at it.

  8. #8
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    Originally posted by cemax
    Try Me.Repaint
    thanks it works.
    i used the repaint method but i also creqted an invisible textbox to hold the name of the subform. the source object is then read from there.

    thanks for your help
    greatly appreciated.
    Actionant

Posting Permissions

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