
Signature
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.
> Below is my constant and the code that uses it. This works great as it is.
>
[quoted text clipped - 25 lines]
> with this situation would be greatly appreciated. Thanks for all of the
> help.......
Thanks........I'll give that a try. I was pretty sure there was a way to get
around this. Thanks again.

Signature
JT
> Just set you location to something like myString="c:/whatever" from a cell or
> whatever you like then concantenate
[quoted text clipped - 31 lines]
> > with this situation would be greatly appreciated. Thanks for all of the
> > help.......
I have tried that and I get a compile error......"Constant Expresssion
Required".
Any thoughts on what I am doing wrong? Is it the location of the constant
in my code? Thanks again

Signature
JT
> Just set you location to something like myString="c:/whatever" from a cell or
> whatever you like then concantenate
[quoted text clipped - 31 lines]
> > with this situation would be greatly appreciated. Thanks for all of the
> > help.......
Dave Peterson - 25 Jan 2007 21:14 GMT
That expression is not a constant.
dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& myString & ";Persist Security Info=False"
> I have tried that and I get a compile error......"Constant Expresssion
> Required".
[quoted text clipped - 46 lines]
> > > --
> > > JT

Signature
Dave Peterson
NickHK - 26 Jan 2007 04:17 GMT
Constants need to be, erm....constant. One way is to include a place holder
in the constant, and just replace that with the correct value when required:
Const ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=**HOLD**;Persist Security Info=False"
Call Recordset.Open(vSQL, Replace(ConnectionString, "**HOLD**",
Range("A1").Value), adOpenForwardOnly, adLockReadOnly,
CommandTypeEnum.adCmdText)
It may not be advisable to call your record set, buy that name in:
Dim Recordset As ADODB.Recordset
To avoid confusion call it something else, maybe "RS".
NickHK
> I have tried that and I get a compile error......"Constant Expresssion
> Required".
[quoted text clipped - 37 lines]
> > > with this situation would be greatly appreciated. Thanks for all of the
> > > help.......