SQL statement to run on the OnClick event
But I keep getting error 2342: "A RunSQL action requires an argument consisting of an SQL statement.", when it runs in code.
Variable stSQL, after being assigned returns in the immediate window as:
Thank you for taking the time to report an issue.
What's wrong... Please write below.
SELECT Open_Issues.* FROM Open_Issues WHERE ((Open_Issues.Account_No)=(Forms.Open_Issues_Viewe r.Text64));
It tells me that the RunSQL action must have an SQL statement for an arguement when I try to run the macro. I thought that was a perfectly valid SQL statement considering I checked it with a query
How can I convert the statement below so it will run in MS Access?
SELECT =Format([SKP B],"00000") AS Expr1
Then from this query, I want to combine the SKP B (with the leading zero's) and SKP A into one row in Access, and use the following SQL statement to do that:
SELECT [Field1] & "-" & [Field2] AS Field1_Field2
The problem that I run into is that when I run the 2nd SQL statement the leading "O's" are dropped.
I know that you can do this in two separate queries but I would much rather do it in one if that is possible.
So my question is, is there a way to run two SQL statements in one query?
OR is there a way for me to combine both of these statements into one SQL query?
in my form I have a input box that the user types in a house number. When the user clicks the street name combobox a query runs that selects the unique street names with that house number.
In the row source of the combobox I Have this:
SELECT [qry_license_combobox_populate].[Street_Name] FROM qry_license_combobox_populate ORDER BY [Street_Name];
This works fine.but if I go back and type in a new house number and click the button it does not refresh the combobox. Just trying to figure out how to re-run the query and repopulate the combobox every time the user clicks the combobox.can I fire the query to populate the combobox on the onclick event? I copied and paste the line above to the Onclick event and get errors.although I now have that line on the row source and the onclick event.
Does anyone know how to edit the code in the "onclick" event immediately after it is created in vba?
I hope I have been clear enough in my question
This example will use the SQL statement to create an Access query, but you can use the statement in a macro or VBA as well.
Report: rptAgentByDate (as a sample)
Trying to search for this proved useless, as "onclick" isn't terribly useful in a search
Is it best to check before the query is run in the VBA, or in the SQL statement it's self to avoid this problem better?
I'm not sure how I even would check the table with SQL.