Reformat a Field to match external data

Ok, great so now you have allowed me to get that line of code to work. Now I have a "item not found in this collection" error on the line:

Me.txtTablePercent2 = Rst!Fields!TablePercent

Rst!Fields!TablePercent is not found in the collection.

I simply removed the Fields! from the code and now everything is working great! So it reads

Me.txtTablePercent2 = Rst!TablePercent

Thanks again, you have been soooo helpful with these issues. I am fairly new to Access and your responses have allowed me to solve issues I am having with other code.
 
Glad you figured it out. My syntax was wrong. The Rst!Fields should have been Rst.Fields but Fields is not needed unless the field name has spaces, in that case it would be Rst.Fields![Field Name] or Rst.Fields("[Field Name]")
 
Good Morning Bill,

I am still working on this code issue you have been so helpful with. I am now trying to take the calculated field from my form, for the ProductID with the leading 2, ex. 2000976, and put that data onto a label (Report). I am currently at a loss as to how to make this happen.

I want the label (Report) to show the measurements of both items. The second items measurements are calculated in VBA as we worked on previously.

So if a Form field is Unbound and calculated, should I try to store this data in a table? This would make things un-normalized but I can not think of any other way to complete this. Could I somehow store the calculation under the Text Box Name, ex. txtStoneLength2 and use this on a Report?

Any suggestions or starting points would be greatly appreciated.

I had the idea to use something like:

Reports!Label_Pair!txtLabelStone2Length = DLookup("[StoneLength]", "Stones", "[StoneName] = " & ProductIDStone2)

but I have no idea if this would be a proper syntax or if this is possible.
 
You can do the same to determine your ProductIDStone2 in your report as you did before and then use your DLookup("[StoneLength]", "Stones", "[StoneName] = " & ProductIDStone2) statement. The difference is you need to place the code in the Detail Section On Format Event and it will only show either in Print Preview or when you print.
 

Users who are viewing this thread

Back
Top Bottom