By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

Use of with

P: n/a
Hi,

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
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 13 '05 #2

P: n/a
John M wrote:
Hi,

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


You might want to set DataInput to a form object. Ex:

Sub FormTest()
Dim f As Form
Dim s As String
s = "DataInput"
Set f = Forms!DataInput 'assumes DataInput is open.
'or Set f = Forms(s)
'or Set f = Forms("DataInput")
With f
MsgBox .Name
End With
Set f = Nothing
End Sub
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.