External Name Not Defined msg during debugging a module

  • Thread starter Thread starter Joanne
  • Start date Start date
J

Joanne

I am using Access 97. I placed command buttons on a
dialog box that shows a list of queries. I am able to
have the first entry highlighted but I am unable to
operate 2 of the command buttons. One is to preview the
highlighted query and the other is to display the query.

This is the procedure I wrote:
Private Function PreviewQuery()
'open the selected query inthe Print Preview window
DoCmd.OpenQuery [QueryList], acViewPreview
End Function

Private Function DisplayQuery()
'Open the selected query in DAtasheet view
DoCmd.OpenQuery [QueryList], acViewNormal
End Function

When debugging I get the External Name Not Defined and
[QueryList] Highlighted.

QueryList worked fine with the highlighting of the first
query so what is my problem?
 
The OpenQuery method requires a string variable of the
query name.

DoCmd.OpenQuery "QueryList",acViewPreview


That assumes the name of the query is QueryList


Chris Nebinger
 
Joanne said:
I am using Access 97. I placed command buttons on a
dialog box that shows a list of queries. I am able to
have the first entry highlighted but I am unable to
operate 2 of the command buttons. One is to preview the
highlighted query and the other is to display the query.

This is the procedure I wrote:
Private Function PreviewQuery()
'open the selected query inthe Print Preview window
DoCmd.OpenQuery [QueryList], acViewPreview
End Function

Private Function DisplayQuery()
'Open the selected query in DAtasheet view
DoCmd.OpenQuery [QueryList], acViewNormal
End Function

When debugging I get the External Name Not Defined and
[QueryList] Highlighted.

QueryList worked fine with the highlighting of the first
query so what is my problem?


I don't know why any of that worked, you need to use a
string to specify the name of the query:

DoCmd.OpenQuery "QueryList", . . .
 
THanks for the help
-----Original Message-----
Joanne said:
I am using Access 97. I placed command buttons on a
dialog box that shows a list of queries. I am able to
have the first entry highlighted but I am unable to
operate 2 of the command buttons. One is to preview the
highlighted query and the other is to display the query.

This is the procedure I wrote:
Private Function PreviewQuery()
'open the selected query inthe Print Preview window
DoCmd.OpenQuery [QueryList], acViewPreview
End Function

Private Function DisplayQuery()
'Open the selected query in DAtasheet view
DoCmd.OpenQuery [QueryList], acViewNormal
End Function

When debugging I get the External Name Not Defined and
[QueryList] Highlighted.

QueryList worked fine with the highlighting of the first
query so what is my problem?


I don't know why any of that worked, you need to use a
string to specify the name of the query:

DoCmd.OpenQuery "QueryList", . . .
 
Back
Top