query code failes on different PC

L

Leanne

Hi,

I have the following code to refresh a query and it works fine until I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 
N

Nigel

Check the query table definition, it is probably attempting to access an
external file that is not on your new machine.
 
J

Jim Cone

Try...
Sheets("Invoice Due").Range("A7").QueryTable.Refresh BackgroundQuery:=False
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Leanne"
wrote in message
Hi,
I have the following code to refresh a query and it works fine until I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 
F

FSt1

hi
unless the pcs are accessed the file from a common file on the network, each
pc must have the data source declared because the file path to the data
soruce may be different from different pcs.

Regards
FSt1
 
M

Mark Ivey

Leanne,

You will probably have to update the location of your data file in your
query...

Select DATA | IMPORT EXTERNAL DATA | EDIT QUERY
 
L

Leanne

Hi All,

Thank you all for your comments. I was hoping to make this file plug and
play but I guess that will not be the case and I will have to install it on
each computer myself - the users will not get it right! If only they were
networked..............
 
L

Leanne

I have tried this but I am not to sure how to change the file path. When the
first box comes up in edit it lets me chose the new location but then after
entering the dates it gives me the following messsage [Microsoft][ODBC Excel
Driver] and then the file path is an invalid path but will not let me do
anything more. Either that or I get a runtime error!

Please help
 
M

Mark Ivey

Is there anything different about their version of Excel?

Did they get a full install?

You may need to get out the Installation CD and see if there were any
features overlooked during install that may be causing a problem with this
issue...

One more thought... do you have both the basic Addins checked (Analysis
Toolpack, and the Analysis Toolpack - VBA)? Reaching, but it may help...

Mark Ivey

Leanne said:
I have tried this but I am not to sure how to change the file path. When
the
first box comes up in edit it lets me chose the new location but then
after
entering the dates it gives me the following messsage [Microsoft][ODBC
Excel
Driver] and then the file path is an invalid path but will not let me do
anything more. Either that or I get a runtime error!

Please help


Leanne said:
Hi All,

Thank you all for your comments. I was hoping to make this file plug and
play but I guess that will not be the case and I will have to install it
on
each computer myself - the users will not get it right! If only they
were
networked..............
 
L

Leanne

Hi Mark,

I did not have these checked on my development computer. What difference
there is between excel is 2000 & 2003 version. I do not know what the other
users will have but would guess they will be the same or newer versions.


Mark Ivey said:
Is there anything different about their version of Excel?

Did they get a full install?

You may need to get out the Installation CD and see if there were any
features overlooked during install that may be causing a problem with this
issue...

One more thought... do you have both the basic Addins checked (Analysis
Toolpack, and the Analysis Toolpack - VBA)? Reaching, but it may help...

Mark Ivey

Leanne said:
I have tried this but I am not to sure how to change the file path. When
the
first box comes up in edit it lets me chose the new location but then
after
entering the dates it gives me the following messsage [Microsoft][ODBC
Excel
Driver] and then the file path is an invalid path but will not let me do
anything more. Either that or I get a runtime error!

Please help


Leanne said:
Hi All,

Thank you all for your comments. I was hoping to make this file plug and
play but I guess that will not be the case and I will have to install it
on
each computer myself - the users will not get it right! If only they
were
networked..............



:

Hi,

I have the following code to refresh a query and it works fine until I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 
M

Mark Ivey

I am not sure...

What version of Excel is on your developers PC?

What version of Excel is on the PC(s) you are having an issue with?

Mark

Leanne said:
Hi Mark,

I did not have these checked on my development computer. What difference
there is between excel is 2000 & 2003 version. I do not know what the
other
users will have but would guess they will be the same or newer versions.


Mark Ivey said:
Is there anything different about their version of Excel?

Did they get a full install?

You may need to get out the Installation CD and see if there were any
features overlooked during install that may be causing a problem with
this
issue...

One more thought... do you have both the basic Addins checked (Analysis
Toolpack, and the Analysis Toolpack - VBA)? Reaching, but it may help...

Mark Ivey

Leanne said:
I have tried this but I am not to sure how to change the file path.
When
the
first box comes up in edit it lets me chose the new location but then
after
entering the dates it gives me the following messsage [Microsoft][ODBC
Excel
Driver] and then the file path is an invalid path but will not let me
do
anything more. Either that or I get a runtime error!

Please help


:

Hi All,

Thank you all for your comments. I was hoping to make this file plug
and
play but I guess that will not be the case and I will have to install
it
on
each computer myself - the users will not get it right! If only they
were
networked..............



:

Hi,

I have the following code to refresh a query and it works fine until
I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 
L

Leanne

Oddly enough the development pc is 2000 and the one I am having trouble with
is 2003

Mark Ivey said:
I am not sure...

What version of Excel is on your developers PC?

What version of Excel is on the PC(s) you are having an issue with?

Mark

Leanne said:
Hi Mark,

I did not have these checked on my development computer. What difference
there is between excel is 2000 & 2003 version. I do not know what the
other
users will have but would guess they will be the same or newer versions.


Mark Ivey said:
Is there anything different about their version of Excel?

Did they get a full install?

You may need to get out the Installation CD and see if there were any
features overlooked during install that may be causing a problem with
this
issue...

One more thought... do you have both the basic Addins checked (Analysis
Toolpack, and the Analysis Toolpack - VBA)? Reaching, but it may help...

Mark Ivey

I have tried this but I am not to sure how to change the file path.
When
the
first box comes up in edit it lets me chose the new location but then
after
entering the dates it gives me the following messsage [Microsoft][ODBC
Excel
Driver] and then the file path is an invalid path but will not let me
do
anything more. Either that or I get a runtime error!

Please help


:

Hi All,

Thank you all for your comments. I was hoping to make this file plug
and
play but I guess that will not be the case and I will have to install
it
on
each computer myself - the users will not get it right! If only they
were
networked..............



:

Hi,

I have the following code to refresh a query and it works fine until
I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 
M

Mark Ivey

You should check to see if it was a full installation....

There may be some DLLs, OCXs, etc. that did not get installed on the other
PCs. These files may be the answer as to why the calendar controls are not
working.

Did you get my email explaining how to set them up?

Here is a link if you needed to look it over...

http://www.graceba.net/~wmivey/Calendar_Controls.xls

If these controls are missing from your "Additional Controls" list, then I
would suspect that that particular PC did not have a full Office
installation.

Mark Ivey

Leanne said:
Oddly enough the development pc is 2000 and the one I am having trouble
with
is 2003

Mark Ivey said:
I am not sure...

What version of Excel is on your developers PC?

What version of Excel is on the PC(s) you are having an issue with?

Mark

Leanne said:
Hi Mark,

I did not have these checked on my development computer. What
difference
there is between excel is 2000 & 2003 version. I do not know what the
other
users will have but would guess they will be the same or newer
versions.


:

Is there anything different about their version of Excel?

Did they get a full install?

You may need to get out the Installation CD and see if there were any
features overlooked during install that may be causing a problem with
this
issue...

One more thought... do you have both the basic Addins checked
(Analysis
Toolpack, and the Analysis Toolpack - VBA)? Reaching, but it may
help...

Mark Ivey

I have tried this but I am not to sure how to change the file path.
When
the
first box comes up in edit it lets me chose the new location but
then
after
entering the dates it gives me the following messsage
[Microsoft][ODBC
Excel
Driver] and then the file path is an invalid path but will not let
me
do
anything more. Either that or I get a runtime error!

Please help


:

Hi All,

Thank you all for your comments. I was hoping to make this file
plug
and
play but I guess that will not be the case and I will have to
install
it
on
each computer myself - the users will not get it right! If only
they
were
networked..............



:

Hi,

I have the following code to refresh a query and it works fine
until
I
install the file on another PC.

Private Sub CommandButton1_Click()
Sheets("Invoice Due").Activate
Range("A7").QueryTable.Refresh BackgroundQuery:=False
MsgBox "Refresh complete"
End Sub

It shows it failing on line
Range("A7").QueryTable.Refresh BackgroundQuery:=False

Can any one help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top