to open a form in VBA why do i need to dimension 2 stringvariable?

P

Peter

When i want to open a report in a form (with VBA) i only
need to dimension 1 string variable

When i want to open a form instead of a report i need to
dimension 2 stringvariable (see down here)

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "University"
DoCmd.OpenForm stDocName, , , stLinkCriteria

I do not understand what the second string variable
(stLinkCriteria) does or stand for.

Thanks
 
D

Dirk Goldgar

Peter said:
When i want to open a report in a form (with VBA) i only
need to dimension 1 string variable

When i want to open a form instead of a report i need to
dimension 2 stringvariable (see down here)

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "University"
DoCmd.OpenForm stDocName, , , stLinkCriteria

I do not understand what the second string variable
(stLinkCriteria) does or stand for.

It's entirely unnecessary, unless you intend to use it to pass criteria
for the form. You could just as easily write:

Dim stDocName As String

stDocName = "University"
DoCmd.OpenForm stDocName

For that matter, you don't really need stDocName, either. You can just
write this:

DoCmd.OpenForm "University"

The command button wizards crank out this code from templates that leave
"blanks" for the common variables. When you're writing your own code,
you can dispense with them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top