update query

Forum home » Delegate support and help forum » Microsoft Access Training and help » Update Query

Update Query

resolvedResolved · Urgent Priority · Version 2007

James has attended:
Access Intermediate course

Update Query

Afternoon,

I have a master table called Master Revenue sheet which breaks down all orders and charges by client.

Recently a client changed their name from "Adstream TV" to "Adstream" and I want to go in and change all previous entries of "Adstream TV" to "Adstream" in order to group them all together moving forward yet have forogtten how to do this. Can you please advise how to please

Thanks

James

RE: Update Query

Hi James

Thank you for your question

You need to create an update query to accomplish this.

Create a basic select query in the normal way that includes the field that you need to update. On the design ribbon select update query from the query type group. In the design table enter Adstream in the update to row and adstreamtv in the criteria row.


If the table you are updating is also linked to other tables and you have enabled referential integrity, you will also need to allow cascade updates. To do this open the relationships window, double click on the link and select the appropriate check box

I would also strongly advise that you back up the database before running this procedure

Regards

Stephen


 

Access tip:

Calculating The Difference Between Dates

If you wish to calculate the time between two date fields, this can be done in a number of ways:

1. As a calculated field in a query
2. As a calculated control in a form or report
3. As a calculation in a VBA procedure.

The basic syntax to get the number of days between two dates is:

=[One Date Field] - [Another Date Field]

You can also use one of the following functions:

=Month([One Date Field] - [Another Date Field])
which calculates the number of months between the two fields

=Year([One Date Field] - [Another Date Field])
which calculates the number of years between the two fields.

Another function is the DateDiff() function.

It uses an argument to determine how the time interval is measured. For example:

=DateDiff("q",[One Date Field] - [Another Date Field])
returns the number of quarters between the two fields.

Other intervals that can be used in this expression are as follows:
"yyyy" - Years
"m" - Months
"d" - Days
"w" - Weekdays
"ww" - Weeks
"h" - Hours
"n" - Minutes
"s" - Seconds

View all Access hints and tips


Server loaded in 0.05 secs.