hi
basicly your code is creating a new query each time your code is run.
Microsoft query will not overwrite an existing query so it creates a new
query beside the old query.
solution: archive the code you have now and replace it with update code and
attached the update code to the button.
assuming that your MSQ is on sheet 1 cell A1.....
sub refreshMSQ()
Sheets("Sheet1").activate
Range("A1").QueryTable.Refresh BackgroundQuery:=False
Msgbox "Refresh complete"
End sub
Adjust sheet name and MSQ range to suit.
Regards
FSt1
> Hi, I have the following code in to run a query from a button and this works
> great - except for the fact that instead of replacing existing data it places
[quoted text clipped - 34 lines]
> End With
> End Sub
Leanne - 17 Apr 2008 12:00 GMT
Thank you so much - I never would have imagined that such a small amount of
code could replace all that I had.
If only I could solve my lookup/record change issue!
> hi
> basicly your code is creating a new query each time your code is run.
[quoted text clipped - 52 lines]
> > End With
> > End Sub