Is this code inside of a procedure (Function, Sub, Property, Event...). If not, that is why.
If it is inside of a procedure, post the code.
--
Al Reid
"It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so." --- Mark Twain
"Larry Bird" <anonymous RemoveThis @discussions.microsoft.com> wrote in message news:A2D6B9D4-4011-4576-83D7-AE1EC26631FC@microsoft.com...
> When I run the code below I get an error message of : "Compile error: invalid outside procedure"
>
> Below I'm trying to open an Access 2003 database. Why do I get this error
>
> Dim Cnxn As ADODB.Connection
> strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0" & ";Data Source=" & "C:\TravelandStop.mdb"
> Cnxn.ConnectionString = strCnxn
> Cnxn.Open
>
> thanks
>
><!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Compiler error: Invalid outside procedure