Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update function (access 2000)

    In my update function i enumerate the 12 branches line by line. Is there any way to update all branches in one
    line ?
    here is the example :

    strSQLC = " UPDATE products1 INNER JOIN products ON [products1].[productid]=[products].[productid] SET " & _
    " products.branch1 = [products1].[branch1]" & _
    " products.branch2 = [products1].[branch2]" & _
    etc
    etc

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: update function (access 2000)

    Try this:

    ' Declare loop index
    Dim i As Integer
    ' Initial part
    strSQL = "UPDATE Products1 INNER JOIN Products ON Products1.ProductID=Products.ProductID SET "
    ' Loop through branches
    For i = 1 To 12
    strSQL = strSQL & "Products.Branch" & i & " = Products1.Branch" & i & ", "
    Next i
    ' Get rid of the last ", "
    strSQL = Left(strSQL, Len(strSQL) - 2)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •