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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 200 update query

Status
Not open for further replies.

pweegar

Programmer
Nov 3, 2000
403
US
How do I create an update query in Access 2000 where the update is based on a value in a text field?

What I am getting at is this: I have a table containing a field called mco_year. On my form, I have a text box that the user enters a year and the year is checked for a field range. How do I use this value (txtYear.value) in an update query? I tried using me!txtYear.value in the update query's update to and/or criteria boxes. Everytime I run the query from my form (using the DoCmd openquery), I get a box asking for a value, and not from my text box.

I'm so confused!
 
First of all the form control txtYear, is this what you want to use as the selection criteria in your table to determine which records to select? I am assuming, Yes. Now if that is so then what do you want to update. Which field? And what do you want the field updated with. What value? Here is an example of a queries SQL that selects from a table records that match the value in your forms textbox, assuming that your field mco_year is text. If numeric we need to convert the form controls value to Numeric. Just let me know. This query then updates the year with

UPDATE tblYourTable as A SET A.[Update_field]= "new data"
WHERE (((A.mco_year)=[FORMS]![frmYourForm]![txtYear]));

Please post back with the requested information.


Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top