Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Toggle Box Updating Subform

    I have a problem I hope someone can help me out with.
    I am creating a sub form that needs basicaly two view points, It looks at the data at the seller's view point and the buyers view point. Basicaly the sub form has all of the fields needed for both view points and I need to hide certain fields based on an option box in the main form. the code i used to set it up on load works fine. it is as follows

    If Forms![form:_PCRKMS_Selection]![Customer_View] = 1 Then
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = True And Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = False
    Else: Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = True And Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = False
    End If

    This works fine, but when I change the option box I cant figure out how to make the subform refresh with the right view set.
    i have tryied it this way]

    Private Sub Customer_View_Click()
    'If Forms![form:_PCRKMS_Selection]![Customer_View] = 1 Then
    'Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = True And Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = False
    'ElseIf Forms![form:_PCRKMS_Selection]![Customer_View] = 2 Then
    'Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = True And Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = False
    'End If
    'DoCmd.Requery "Subform:_PCRKMS_Selection_Data"
    End Sub

    this does not work, I have tried to put it in the load of the subform and I get errors.
    Any suggestions would be great
    Thanx
    Jim

  2. #2
    Join Date
    Feb 2002
    Posts
    403
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Se
    lection_Data]![Sh_Concern].Requery in the after update event of the toggle control

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    when I add that line to my application, did you mean for me to add it by itself or after my if then statement?
    for some reason when I put in the IF Than statment into the on load of the subform I get an error about it not being able to evaluate the statment, is that because you cant use an on load in a subform? Didnt think there was that limitation. Does the subform load first so that it cant evaluate a function on the main form?
    Help if you can
    Thanx
    Jim

  4. #4
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    I got it!!!
    this is what I had to do:

    If Forms![form:_PCRKMS_Selection]![Customer_View] = 1 Then
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = True
    End If
    If Forms![form:_PCRKMS_Selection]![Customer_View] = 1 Then
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = False
    End If

    If Forms![form:_PCRKMS_Selection]![Customer_View] = 2 Then
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Sh_Concern].Visible = False
    End If
    If Forms![form:_PCRKMS_Selection]![Customer_View] = 2 Then
    Forms![form:_PCRKMS_Selection]![Subform:_PCRKMS_Selection_Data]![Cn_Concern].Visible = True
    End If

    for some reason it did not like to evaluate the full complex if statment, so I had to break it up.
    Thanx for all of your help
    Jim

Posting Permissions

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