I am a beginner with access and I am trying to create a basic search. I am getting a “runtime error 2001 you canceled the previous operation” when I click the command button and then cancel the search. I used the code below for the on click event for the command button.
Private Sub Command225_Click()
DoCmd.OpenQuery "Issue_Search", acViewNormal
The code I used in the query “Issue_Search” is below.
Like [forms]![searchform].[issue_search] & "*"
Also another question I have is after clicking the search button the pop up search box contains the code from referenced query. Does anyone know how to change the text for this pop up box? I am hoping someone can help me out here? TIA.
The query is looking for "[forms]![searchform].[issue_search]" and when the query can not find that (in this case a form named searchform with a field on it named issue_search) then it pops up a window asking the user to supply that variable data. If you do have a form named searchform with a field on it named issue_search, then that form is not open when you are running this query if that window pops up. If you now say to yourself, "See it is open" then there is a misspelling somewhere, be it form name or field name.
You said "The code I used .... is below" There has got to be more to the SQL string for this query than what you have shown. Could you show us the rest of the SQL string?
The pop up search box will show any variable that it can not find. Therefore, if you don't want "[forms]![searchform].[issue_search]" to show in the pop up box, then change it to what you do want to show in the pop up box.