Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stLinkCriteria 3

Status
Not open for further replies.

bcobb2350

Programmer
May 23, 2007
2
US
I'm new to Access and VBA - so most of the things I do are copies of something someone else has done.

I'm using the following code to open another form.
============================
Dim strDocName As String
Dim stLinkCriteria as String

strDocname = "frmSignIn"

DoCmd.OpenForm strDocName, , , stLinkCriteria
==============================================

The question is: What is the function of stLinkCriteria and do I need to use it at all.

All help is greatly appreciated.
 
Open your Visual Basic editor, go to the help file, and type in OpenForm. In your case you're asking about the WhereCondition clause.

"WhereCondition Optional Variant. A string expression that's a valid SQL WHERE clause without the word WHERE."

As stLinkCriteria is not defined, it would be ineffective.

HTH,
Don [bigglasses]
 
If you look at the help file for the function of DoCmd.OpenForm, you will see that the parameter being filled by stLinkCriteria in your example is for filtering of the report. It is a way to filter the data when the report is opened. The parameter would be the same as a WHERE clause without the WHERE.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
BTW, here is the example from the help file.

DoCmd.OpenForm "Employees", , ,"LastName = 'King'"

Don [bigglasses]
 
Thanks to everyone! This was a great help to me. I can see where there might be a need for that in the future, but not in my context.

This was a great help!
 
The reason it's there is because the original programmer created it with a wizard. If you typed it yourself and there were no filter criteria, you would just leave it out, i.e.
Code:
DoCmd.OpenForm strDocName


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top