- Local time
- Yesterday, 17:44
- Joined
- Oct 29, 2018
- Messages
- 22,513
Hi Stephen. Glad to hear you're making good progress. Normally, you won't know how many column the crosstab query will produce, but you should know beforehand how many textboxes you have on the report, because it obviously have a limited amount of space, plus you would have to place those textboxes yourself at design time.Well wouldn't ya know I managed to work it out so thank you for your patience. It took a bit of working out as to how to set the parameter up in VBA but that works perfectly now too. So the only thing left to do is for me to change the hard-coded column names in the PrintDetail event to a generic bit of code that will loop through the column values in the same way but without having the column names hard-coded. So what I currently have is:
If IsNull(Me.[Fforest fields XC - MEN]) Or IsNull(Me.[Croft Castle XC race -MEN]) Or IsNull(Me.[Queenswood XC Race -MEN]) Then
Cancel = vbCancel
Me.MoveLayout = False
End If
So I need to know how many fields there are in total to loop through and then refer to each field in turn to see if it is null or not. Is there a way of doing that without hardcoding the field names like I have here?
Thanks
Stephen
The usual approach is to name the textboxes with a number suffix, so you can loop through them.