subform to subform assistance

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello Newsgroup. I have a dilemma regarding referencing a subform to a
subform in an expression. Below is the expression and it is not working
properly. This expression is in a textbox on a subform that needs to count
how many comments there are based on the other subform (which is the foreign
key in the subform the expression is in.

=DSum("[VehicleMaintenanceCommentID]","[tblVehicleMaintenanceComment]","[VehicleMaintenanceID] = sfrmVehicleMaintenanceSubform.Form!VehicleMaintenanceID")

I thank anyone who responds to this.

..... John
 
Hey John,

Follow the link below and see if it doesn't shed some light on your situation.


http://www.mvps.org/access/forms/frm0031.htm

HTH,
Shane
Hello Newsgroup. I have a dilemma regarding referencing a subform to a
subform in an expression. Below is the expression and it is not working
properly. This expression is in a textbox on a subform that needs to count
how many comments there are based on the other subform (which is the foreign
key in the subform the expression is in.

=DSum("[VehicleMaintenanceCommentID]","[tblVehicleMaintenanceComment]","[VehicleMaintenanceID] = sfrmVehicleMaintenanceSubform.Form!VehicleMaintenanceID")

I thank anyone who responds to this.

.... John
 
Shane, thanks for the info but it didn't. I'll see if I can clarify, the
main form has 2 subforms on it (Sub1 & Sub2 for simplicity). Sub1 is the
many to the one of the main form and Sub2 is the many to the on of Sub1.
Sub2 has the txtbox on it that is counting how many in Sub2 there are that
match the one in Sub1. I got to this but it still isn't working like it
should. The ID and tbl are for Sub2 and the criteria is for Sub1.

=DSum("[VehicleMaintenanceCommentID]","[tblVehicleMaintenanceComment]","[VehicleMaintenanceID]='Form!Sub1!VehicleMaintenanceID'")

So if you or any others know how it should be, thanks, because I am at a
loss. It is the criteria part of the expression

.... John



shanesullaway via AccessMonster.com said:
Hey John,

Follow the link below and see if it doesn't shed some light on your situation.


http://www.mvps.org/access/forms/frm0031.htm

HTH,
Shane
Hello Newsgroup. I have a dilemma regarding referencing a subform to a
subform in an expression. Below is the expression and it is not working
properly. This expression is in a textbox on a subform that needs to count
how many comments there are based on the other subform (which is the foreign
key in the subform the expression is in.

=DSum("[VehicleMaintenanceCommentID]","[tblVehicleMaintenanceComment]","[VehicleMaintenanceID] = sfrmVehicleMaintenanceSubform.Form!VehicleMaintenanceID")

I thank anyone who responds to this.

.... John
 
John,

I hope I'm following you correctly so here goes a stab at it. (criteria part
only since thats all you need help on)

"[VehicleMaintainceID] = " & Forms![MainFormName]![subform1].Form!
[VehicleMaintenanceID] (this is assuming VehicleMaintenanceID is a number)

HTH,
Shane
Shane, thanks for the info but it didn't. I'll see if I can clarify, the
main form has 2 subforms on it (Sub1 & Sub2 for simplicity). Sub1 is the
many to the one of the main form and Sub2 is the many to the on of Sub1.
Sub2 has the txtbox on it that is counting how many in Sub2 there are that
match the one in Sub1. I got to this but it still isn't working like it
should. The ID and tbl are for Sub2 and the criteria is for Sub1.

=DSum("[VehicleMaintenanceCommentID]","[tblVehicleMaintenanceComment]","[VehicleMaintenanceID]='Form!Sub1!VehicleMaintenanceID'")

So if you or any others know how it should be, thanks, because I am at a
loss. It is the criteria part of the expression

... John
Hey John,
[quoted text clipped - 16 lines]
 
Back
Top