On Tue, 22 Feb 2005 11:27:20 +0200, only.DeleteThis@here.co.za wrote:
>(This doesn't work but I would like something like it: )
>
>db.Execute "Update INTO Jobcard Values * "
>
>Where I want to update all the fields from the Access statement into
>SQL without having to iterate through each field.
>
>I have over 100 tables, each with at least 10 fields so I would save a
>lot of time if I could just update all the fields at once.
There's no way I know of to UPDATE without listing each field value.
UPDATE JobCard
SET [Field_1] = 'First', [Field_2] = 'Second'
WHERE RecordId = 55
however, you will see that you can update a single record in one
statement. So, write a function to generate the SQL statement. You
could look for the SmartSQL Class from <a style='text-decoration: underline;' href="http://www.freevbcode.com," target="_blank">www.freevbcode.com,</a> or
something similar - it may save you some time.
Dim oSQL As New SmartSQL.clsSmartSQL, sSQL As String
oSQL.AddTable "Order Items"
oSQL.AddFields "ItemCost", "Tax", "ShippingCost", "TotalCost"
oSQL.AddSimpleWhereClause "OrderID", 1
sSQL = oSQL.SQL
‘ Resuting sSQL = "SELECT ItemCost, Tax, ShippingCost, TotalCost FROM
[Order Items] WHERE (OrderID = 1)"
You can change the SQL to an update query using a property, I think.
_______________________
Michael B. Johnson<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Can I Update entire record in SQL ?