Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get calculation to work for my form

Status
Not open for further replies.

darylclassen

IS-IT--Management
Jul 26, 2003
13
0
0
CA
I have a form with a subform. Text0 and Text2 are on the main form. PercentageTotal is on the subform. I'm trying to make an if statement where it will do one thing if the total of all 3 fields is below 101, and another if it is not. Here is my code...Please help me!

Private Sub Command2_Click()
If Me![BreakdownPercentageTotal subform].Form.PercentageTotal + Me.Text0 + Me.Text2 < 101 Then GoTo GoAhead Else GoTo TooMuch

GoAhead:
Exit Sub

TooMuch:
hmm = MsgBox(&quot;Okay.&quot;, 0, &quot;Whatever.&quot;)
Exit Sub


End Sub
 
Nevermind, figured it out. For anyone else wondering why things aren't working when refering to a field on a subform, here's the proper syntax.

Forms![main form name]![subform control name].Form![control name]
 
This syntax should also work for you:

Forms!MainFormName!SubFormName!ControlName

&quot;Advice is a dangerous gift, even from the wise to the wise, for all course may run ill.&quot; J.R.R. Tolkien
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top