create a form for an update query

accessHel

New Member
Joined
Feb 12, 2013
Messages
3
help!!!
I am new to access .. I've already done several queries for a certain table (books). and i am able to create forms for them. but what about creating a form for an update query (set.. where..)
any suggestion how to do that? any clarified steps!!
thanks in advance
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
What do you need to do? Are you updating a price list, for example, or trying to place a calculation in a table?

You can't base a form on an action query (Update, Delete, Append or Make-Table) because they don't return recordsets (rows and columns) like standard Select queries do.
What you can do is create some code behind a command button to run the update query.

These are the steps that I would use to build it using the interface:
Say that MyForm has SomeTextbox, which you want to use as a parameter in a query.
Build the query, placing the field that you want to update in the grid. If the parameter is based on a different field place that in the grid too, but clear the checkbox so it doesn't display.
In the Criteria row for your filter field type [Forms]![MyForm]![MyTextbox] (change to suit the actual names), then make sure that the form is open and has a valid value in the textbox, and run the query.
If it's giving you the data you expect, convert it to an Update query. Go to design view in the query. In 2007 or 2010, select Update from the Design tab. In 2003 or lower, pick Update from the Query menu.
Now edit the Update row in the grid to give you the value or calculation that you want to update your field to. Save the query as qupdChangeData (or equivalent; I use a range of prefixes for queries so I know what they do. It groups them in the navigation, convenient when searching through huge numbers of objects).
Now the button. In design view on your form, drag a button onto the surface. The wizard should launch. From the list of options on the right pick Miscellaneous, then Open Query (or Run Query?). Pick your query from the list, go through the rest of the wizard, and try it out.

Denis
 
Upvote 0
thank you
what i'm trying to do is that i have already created an access program for a library. there's a table having all the books found in the library .. I want to do a form to update information about a certain book (ID is a primary key parameter) or to change a mistake done through entering the book's information.
I am able to change the information by going back to the table, but I want to do that through a form.
Is that possible?
 
Upvote 0
Create a form based on the table. Select the table in the navigation, then find the icon to create a new form.
In 2007 and higher it's on the Create tab -- select Form.
In 2003 and before it's near the right of the main toolbar -- Autoform.

You should base all your interfaces around forms; don't make users use the table datasheets directly. Datasheets are more error prone and you don't get the same control over what users can and cannot do.

Denis
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top