Apologies - I'd confused forms and reports earlier for On Load.
I cannot see why you are unable to set the value of the unbound textbox. You can try a different approach here, but in order for it to work your looping routine which sets the value of strEmail must be working. Otherwise you will simply be setting the unbound textbox to a blank value.
You could use a global variable to store the value of strEmail until it is needed. In a report, a global variable is one defined as Public in the header of the report's code module, like this
- Public strEmail as String
You could then remove the local Dim statement for that variable from Sub Report_Open (or whatever it now is). The global will then be storing the value as set by your recordset loop in the sub.
The value of the unbound textbox can be set in the On Format event for the section in which your unbound textbox is placed, using the global variable strEmail to pass the value to the textbox. If your unbound textbox is in the detail section you would place the assignment statement shown earlier in the Detail_Format sub:
- Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
me![name of textbox] = strEmail
-
End Sub
-Stewart