jengo,<br>Set a querydef object for the query, and alter the SQL through the querydef.sql property. This will permanantly change the sql, until you change it again either manually or through the querydefs.sql property.<br>--Jim
I'm new at queries. I don't usually don't deal alot with them. But I do work good with examples could you give me an example of what you mean? I'll probably have a better chance of understanding it. Thanx.
On the forms control source property click on the 3 small dots next to the control source. This will open the QBE grid. Make what ever changes you want to make. Exit, and when prompted say you want to update.
Jengo,<br>First you need to decide where or when you'll change the criteria. I'm going to assume the query you want to change is the recordsource of the form, and not just some random query in the database. For an example, lets say you have a texbox where you'll enter a letter or a few letters of a the name of someone in a customers table, and then a button which will change the criteria to show only customers who'se names start with those letters. In the Click event of the button, do this<br><br>dim sq as string<br>sq = "Select * from Customers where Lastname "<br>sq = sq & " LIKE """ & me!textbox & "*""<br><br>'Now, there are 2 choices--modify the query permanently, so the next time the form opens it retains the last criteria, or just do it temporary. We'll do it the first way here...<br>Dim qd as querydef<br>set qd = currentdb.querydefs("Query that is source of this form"<br>qd.sql = sq<br>me.requery
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.