Solved: subform to subform conditional post

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 

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?
 

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.
 

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.
 

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:
 

OBP

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

Don't you just h*te your boss?
 

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:
 

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.
 

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.
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Members online

Top