I'm not sure if this is the best section to post in.
I'm taking a class on Access and have a database with numerous Queries. One assignment calls for creating a queries dialog box, named frmQueriesDialogBox, to display all queries. I've done that and the dialog box displays all queries. The dialog box also has two command buttons, one to Dispaly a selected query and one to Close the dialog box.
The next part of this is to create VB code which will open a query from the dialog box by either double clicking on the query name in the dialog box list, or clicking the Display button. So, I carefully followed the example in the textbook and added this private function to a VB module called basDisplayQuery. The code is this:
Private Function basDisplayQuery()
'Open the selected query in Datasheet view
DoCmd.OpenQuery lstQueryList, acViewNormal
End Function
I tell Access to compile the code, I save it, then close the VB window and return to the database window.
Next, I open frmQueriesDialogBox is Design view, open the Properties panel, and add =basDisplayQuery() to the On Dbl Click property for the list box, named lstQueryList, and to the On Click property for the Display command button.
Then, I change to Form view to test form. When I try to display a query by clicking on the Display command button or double clicking on the Query name in the list box, I get an error message saying:
"The expression On Dbl Click you entered as the event property setting produced the following error: The expression you enterered has a function name Microsoft Office Access can't find.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro."
Since I believe I've done this exactly as illustrated in the textbook, I have no clue why this error message is occuring. Can someone give me a clue?
I'm taking a class on Access and have a database with numerous Queries. One assignment calls for creating a queries dialog box, named frmQueriesDialogBox, to display all queries. I've done that and the dialog box displays all queries. The dialog box also has two command buttons, one to Dispaly a selected query and one to Close the dialog box.
The next part of this is to create VB code which will open a query from the dialog box by either double clicking on the query name in the dialog box list, or clicking the Display button. So, I carefully followed the example in the textbook and added this private function to a VB module called basDisplayQuery. The code is this:
Private Function basDisplayQuery()
'Open the selected query in Datasheet view
DoCmd.OpenQuery lstQueryList, acViewNormal
End Function
I tell Access to compile the code, I save it, then close the VB window and return to the database window.
Next, I open frmQueriesDialogBox is Design view, open the Properties panel, and add =basDisplayQuery() to the On Dbl Click property for the list box, named lstQueryList, and to the On Click property for the Display command button.
Then, I change to Form view to test form. When I try to display a query by clicking on the Display command button or double clicking on the Query name in the list box, I get an error message saying:
"The expression On Dbl Click you entered as the event property setting produced the following error: The expression you enterered has a function name Microsoft Office Access can't find.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro."
Since I believe I've done this exactly as illustrated in the textbook, I have no clue why this error message is occuring. Can someone give me a clue?