Hi there helper,<br><br>Can you use an update query on a form.<br>I get an error. Someting about an action query.<br><br>How do you use an update query properly on a form.<br><br>Cheers<br>Radman
Radman,<br><br>You cannot use an update query as the data source for a form, if that is what you are asking. You can only use a select query or sql string that performs no action.<br>To run an update query from a form, either put it in a macro and call the macro from a button or other event, or code it in the module behind the form with the docmd object. <p>-Chopper<br><a href=mailto: > </a><br><a href= > </a><br>
Radman,<br>If you want to run an action query from a form, you can set a variable of QueryDef type to refer to that query, and then use the .Execute method, ie<br>dim qd as QueryDef<br>set qd = currentdb.querydefs("myactionquery"<br>qd.execute<br> Or, if you want to just hardcode or dynamically create the Sql, you do:<br><br>Dim sq as string<br>sq = "Update Table1 set Field1 = " & me!SomeTextbox<br>docmd.runsql sq<br><br>--Jim
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.