|
Forum home »
Delegate support and help forum »
Microsoft Access Training and help » access courses - Update Queries acting on only part of a table
access courses - Update Queries acting on only part of a table
The UK's most regular instructor-led training courses.
Training information: access courses
· Microsoft access courses
· Microsoft Access Training uk See also
· microsoft access training
· access vba courses
· access database course Resolved · Low Priority · Version Standard
Update Queries acting on only part of a table
by - delegate Ricardo [8 posts] (2007 Jun 20 Wed, 15:24) Reply
Hi
I have a large-ish table (call it [tbl_accounting] ), with say 9 fields, the primary key being clientname.
I have recently receieved information in an excel spreadsheet such that I can update one of those fields (the "fees" field).
The excel information is in 2 columns - one is the clientname, and the other column contains fees.
I'm sorry if this is a silly question, but how would you run an update query to update only those records who have fee information in the excel spreadsheet, and leave the other fields & records alone?
I imported the excel spreadsheet as a new table (say [tbl_feeimport] making clientname the primary key) and tried to run an update query from that, but it didn't work. I'm sure this can be done via SQL or maybe via the Access update queries, but I'm afraid I'm not sure fully how- any help would be gratefully accepted!
Thanks
Ricardo
RE: Update Queries acting on only part of a table
Hi Ricardo,
The sql you would need is:
UPDATE table_name
SET column_1 = new_value
column_2 = new_value
column_3 = new_value
WHERE primary_key = primary_key_value
Hope this helps
David
RE: Update Queries acting on only part of a table
by - delegate Ricardo [8 posts] (2007 Jul 16 Mon, 10:55) Reply
That's great - thankyou David
Related articles
· MS Access and Database Normalisation
· Material covered on a Microsoft Access Course
· Why go on a Microsoft Access Training Course?
· MS Access: Access your Personal Information with Ease
· Reasons to Consider Microsoft Access Training
| 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 |
|