I'm trying to use conditional compiling in a project.
Bottom Line Up Front
Can I / How do I use conditional compiling in the Declarations section?
Details
I have a Windows app that I'm upgrading so that my Mac users can also use it. The trick is that it accesses an SQL Server backend. On Windows, I can use the ADODB library, but I knew that ADO wouldn't work on the Mac. I'm testing an ODBC driver from ActualTech. I'm using conditional compiling to separate the two methods to submit the SQL statement. But I'm seeing a message for this code in my Declarations section when I run this on the Mac.
#If (Win32 Or Win64) Then
Global rst As ADODB.Recordset
Global cnn As ADODB.Connection
#Else
#End If
The error I'm getting is Can't find project or library.
The line flagged as the troublemaker is the Global rst line.
I know that the library isn't on the Mac, which is why I tried to put it into a conditional compiling block. Am I doing something wrong, or does conditional compiling not work in the Declarations section? The reason I want to make it a global variable is I'm concerned the performance will be bad if I had to reinitialize every time I call a routine. And passing it as a parameter to my routines I don't think is an option because I won't be able to pass an object type that the Mac doesn't recognize.
Bottom Line Up Front
Can I / How do I use conditional compiling in the Declarations section?
Details
I have a Windows app that I'm upgrading so that my Mac users can also use it. The trick is that it accesses an SQL Server backend. On Windows, I can use the ADODB library, but I knew that ADO wouldn't work on the Mac. I'm testing an ODBC driver from ActualTech. I'm using conditional compiling to separate the two methods to submit the SQL statement. But I'm seeing a message for this code in my Declarations section when I run this on the Mac.
#If (Win32 Or Win64) Then
Global rst As ADODB.Recordset
Global cnn As ADODB.Connection
#Else
#End If
The error I'm getting is Can't find project or library.
The line flagged as the troublemaker is the Global rst line.
I know that the library isn't on the Mac, which is why I tried to put it into a conditional compiling block. Am I doing something wrong, or does conditional compiling not work in the Declarations section? The reason I want to make it a global variable is I'm concerned the performance will be bad if I had to reinitialize every time I call a routine. And passing it as a parameter to my routines I don't think is an option because I won't be able to pass an object type that the Mac doesn't recognize.