
February 18th, 2010, 10:24 AM
|
 |
Contributing User
|
|
|
|
Quote: | Originally Posted by BananaRepublic It may not be a case of two control having the same name but rather two objects. For example, if your procedure name has same name as the module, that would be an ambiguous name or something like that. So it's not merely a case of looking in the dropdown but also verifying that there is no other name conflict along different objects. |
I recreated the template, creating each object seperately, as as to avoid the possibility of a control array and the same thing happened. I also don't have any procedures with the same name. The only point it is mentioned in the code is when I reference the object itself.
I've included the sub routine below:
Code:
' Reset captions and heights
ActiveDocument.lblItem1.Caption = ""
ActiveDocument.lblCatcode1.Caption = ""
ActiveDocument.lblQuant1.Caption = ""
ActiveDocument.lblUnitcost1.Caption = ""
ActiveDocument.lblDesc1.Caption = ""
ActiveDocument.lblItem1.Height = "14"
ActiveDocument.lblDesc1.Height = "14"
Do Until x = rowcount + 1
If x = 1 Then
' Populate boxes
ActiveDocument.lblItem1.Caption = ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI1ST_1").Value
ActiveDocument.lblCatcode1.Caption = ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI2ND_1").Value
ActiveDocument.lblDesc1.Caption = ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI3RD_1").Value
ActiveDocument.lblUnitcost1.Caption = ActiveDocument.MailMerge.DataSource.DataFields("UNIT_COST_1").Value
ActiveDocument.lblQuant1.Caption = ActiveDocument.MailMerge.DataSource.DataFields("UNIT_QUANT_1").Value
totalcost = totalcost + (ActiveDocument.MailMerge.DataSource.DataFields("UNIT_COST_1").Value * ActiveDocument.MailMerge.DataSource.DataFields("UNIT_QUANT_1").Value)
' Resize label if text will fill it
If Len(ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI1ST_1").Value) > 16 Then
ActiveDocument.lblItem1.Height = "28"
End If
If Len(ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI3RD_1").Value) > 25 Then
ActiveDocument.lblDesc1.Height = "28"
ElseIf Len(ActiveDocument.MailMerge.DataSource.DataFields("PROV_CCI3RD_1").Value) > 50 Then
ActiveDocument.lblDesc1.Height = "45"
Else
ActiveDocument.lblDesc1.Height = "58"
End If
Else
' STICK SOMETHING IN HERE
End If
' Increase count by 1
x = x + 1
Loop
' Set totalcost into totalcost box
ActiveDocument.lblTotalcost.Caption = "£" + totalcost
|