Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013
    Posts
    2

    Unanswered: Update Query--Vary what field is updated

    All,
    I want the end user to be able to vary what week is updated, either by a vba or like a parameter query. My end users only have the run time version of access and design view is not an option. This one has me stumped and i have not found a solution. wksales.[47] is what needs to be varied. it will always be from the table wksales but i need to vary what week they are updating to, 1 through 52.

    UPDATE WklySalesUpdate LEFT JOIN wksales ON (WklySalesUpdate.yr = wksales.yr) AND (WklySalesUpdate.Item = wksales.item) AND (WklySalesUpdate.Whse = wksales.whse) SET wksales.[47] = [WklySalesUpdate].[qty];

    Please let me know if you need more information!!

    Thanks!

  2. #2
    Join Date
    Nov 2013
    Posts
    2

    solved

    just threw the sequal command into vba!! probably could be cleaned up a bit as my VBA skills are very basic!

    Private Sub Command2_Click()

    Dim strSQL As String
    strSQL = ("UPDATE [WklySalesUpdate] LEFT JOIN [wksales] ON [WklySalesUpdate].[Whse] = [wksales].[whse] AND [WklySalesUpdate].[Item] = [wksales].[item] AND [WklySalesUpdate].[yr] = [wksales].[yr] SET " & "[" & "wksales" & "]" & "." & "[" & Forms![weeklysales update]![Text3] & "]" & " = [WklySalesUpdate].[qty]")
    DoCmd.RunSQL strSQL



    End Sub


    Just linked the field i wanted to change back to a text box on the form.

Posting Permissions

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