1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: subform to subform conditional post

Discussion in 'Business Applications' started by RANCHLAW56, Dec 27, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    I have a form with several tabbed subforms. Several of the subforms are for gathering peoples names and information (lastname, firstname etc.) the forms are named for the persons role (reporting party, complainant, victim, etc.)

    How can I post information entered into one subform if a check box is selected? (reporting party = complainant)

    I am trying to eliminate repetitive entries but have to duplicate information across tables.


    XP / Access 2003
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You should not be duplicating data across tables or forms, so you are doing the right thing.
    But why have more than one subform, why not just have one subform with a Combo Box to select their Role?
     
  3. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    That is the way I have been instructed to do it by the Boss.

    He wants to be able to click on a tab and see each persons info.

    Each person could have multiple roles in the incident.
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Bosses :rolleyes:
    You could set it up so that any record entered in to a particular Tab would have the "Role" field set to the role designated by the Tab Name.
     
  5. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    Boss said table is NOT an option. :rolleyes:

    I know this can be done but I cannot get the code right.

    This is the code I have currently:

    Private Sub ISCOMPLAINANT_DblClick(Cancel As Integer)
    On Error GoTo Err_ISCOMPLAINANT_DblClick


    Me.Parent.Complainant.Form.Race = Me.Race
    Me.Parent.Complainant.Form.POB = Me.POB
    Me.Parent.Complainant.Form.Occupation = Me.Occupation


    Exit_ISCOMPLAINANT_DblClick:
    Exit Sub
    Err_ISCOMPLAINANT_DblClick:
    MsgBox Err.Description
    Resume Exit_ISCOMPLAINANT_DblClick

    End Sub

    Returns the following error:

    Object doesn't support this property or method

    Button is located on the Reporting Party subform and trying to post to the
    Complainant subform. :confused:
     
  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Which line of code does it highlight?

    Don't you just h*te your boss?
     
  7. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    It is not highlighting any of the code.

    Error box pops up and when you closed it returns to the form.



    He can be a little frustrating at times ;) but he just explained his reason. (juvenile law):rolleyes:
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Try remming out the last 2 lines of code and then try removing the Form from
    Me.Parent.Complainant.Form.Race = Me.Race
    to
    Me.Parent.Complainant.Race = Me.Race

    Also check that the name of the subform is correct by trying some VBA in the Mainform that refers to it.
     
  9. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    I have to go now.
     
  10. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    No joy.:(

    I can send you the db if you will im me an address.
     
  11. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    RANCHLAW, I have re-read your thread from the beginning and I am quite willing to look at your database. But before I do I need to confirm how you think it should operate, rather than trying to get what you have to work.
    Are you entering a Person's data in one subform and then trying to put the same data in to another subform (which groups them by Role?

    If so then the operating method is wrong, if you enter the initial data in say Tab 1 then you should save the data and then ReQuery the other tabbed Subforms to update them with the data.
     
  12. RANCHLAW56

    RANCHLAW56 Thread Starter

    Joined:
    Dec 25, 2010
    Messages:
    23
    Thanks for all your help.
    Created a button instead of a check box.
    Here is the code that works.

    Private Sub ISCOMPLAINANT_Click()
    On Error GoTo Err_ISCOMPLAINANT_Click


    If MsgBox("Are you sure you wish to copy this Reporting Party" & vbCrLf & _
    "to the Complainant tab?", vbCritical + vbYesNo) = vbYes Then

    Me.Parent.subComplainant.Form.Last_Name = Me.Last_Name
    Me.Parent.subComplainant.Form.First_Name = Me.First_Name
    Me.Parent.subComplainant.Form.Middle_Name = Me.Middle_Name
    Me.Parent.subComplainant.Form.Photo = Me.Photo

    End If
    Exit_ISCOMPLAINANT_Click:
    Exit Sub

    Err_ISCOMPLAINANT_Click:
    MsgBox Err.Description
    Resume Exit_ISCOMPLAINANT_Click

    End Sub
     
  13. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Where is the copied data being Stored?
     
  14. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/970932

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice