Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query..........? 1

Status
Not open for further replies.

Radman

Programmer
Jan 20, 2000
22
AU
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.&nbsp;&nbsp;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&nbsp;&nbsp;to refer to that query, and then use the .Execute method, ie<br>dim qd as QueryDef<br>set qd = currentdb.querydefs(&quot;myactionquery&quot;)<br>qd.execute<br>&nbsp;&nbsp;&nbsp;Or, if you want to just hardcode or dynamically create the Sql, you do:<br><br>Dim sq as string<br>sq = &quot;Update Table1 set Field1 = &quot; & me!SomeTextbox<br>docmd.runsql sq<br><br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top