Try without any bang or dot, i.e.:
With Forms(stDocName)
That's equivalant to:
With Forms("DataInput")
The brackets refer to the member of the Forms collection.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"John M" <jo**@jmawer.demon.co.uk> wrote in message
news:cl*******************@news.demon.co.uk...
The following works just fine
With Forms!DataInput
!Cwk.visible = True etc ....................
But
Dim StDocName as string
StDocName = "DataInput"
With Forms!StDocName
!Cwk.vis etc....
Fails
I've tried bracket and all sort to no avail.
Thanks in advance