Search form will run query but will not open form based on same query

mitchem1

Registered User.
Local time
Yesterday, 21:27
Joined
Feb 21, 2002
Messages
153
I have a form with 7 unbound combo boxes. Also on the form is a command button called Find Project. The user can use any, all, or none of the combos to find a project. The more that are used, the more the search is narrowed. The command button has code behind it like this:

Dim stDocName As String

stDocName = "qryFindProject"
DoCmd.OpenQuery stDocName, acNormal, acEdit

That works great. The query runs exactly as it should. However, when I replace "qryFindProject" with "frmDisplayProject" (record source is qryFindProject), I receive the error:

Microsoft Access can't find the object 'frmDisplayProject'. The form does exist. Must be doing something very wrong. Any help would be greatly appreciated.
 
doCmd.OpenForm

Are you changing OpenQuery with OpenForm?
 
As I understand your question, you have 2 things:
1) qryFindProject
2) frmDisplayProject
Just guessing from the prefix, 'qry' is a query and 'frm' is a form ?

So
<<
stDocName = "qryFindProject"
DoCmd.OpenQuery stDocName, acNormal, acEdit
<<
works because you are opening a query. That's what OpenQuery does.

If you want to open a form, use OpenForm

RichM
 
I knew it had to be a stupid error. Thank you both.
 

Users who are viewing this thread

Back
Top Bottom