Tempvars and Access 2003

I have a database that is used in a mixed environment 2003, 2007. I have a little functionality that uses the new TempVars 2007 feature. If this is a 2003 user, there is no problem for them not to have these features.

How to write your code so that it compiles and on error resume nextruns in Access 2003. I tried , but this does not work for compile-time errors.

0
source share
2 answers

If your application will be used with Access 2003, it seems to me that you should exclude functions that are not supported in 2003.

, Tempvars, , , .

Option Compare Database
Option Explicit
#Const Aversion = "2007" 'conditional compiler constant '

Public Sub HelloWorld()
    Dim strWho As String
    strWho = "World"

    #If Aversion = "2007" Then
        '* your 2007 feature code here *'
        strWho = UCase(strWho)
    #End If
    'Aversion 2003 -> Hello World '
    'Aversion 2007 -> Hello WORLD '
    Debug.Print "Hello " & strWho
End Sub

" #Const #If.

, , . : YourDb2003.mdb; YourDb2007.mdb. YourDb2003.mdb "2003" "2007" YourDb2007.mdb.

+1

VBA.
#If VBA7 Then Office 2010. , Office 2007.

0

Source: https://habr.com/ru/post/1776342/


All Articles