Domanda

Is it possible to pass only the values of my variables into a pre existing method in Access? For example the outputTo command looks like this

DoCmd.OutputTo acOutputReport, "rptName", acFormatSNP, strAttachmentPath

the strAttachmentPath works fine, I have this declared as strAttachmentPath = "C:...)

It's only a problem when I use a variable to declare the format like so:

DoCmd.OutputTo acOutputReport, "rptName", varFormat, strAttachmentPath

when I declare varFormat = "acFormatSNP" I get an error 'Compile error: Invalid Qualifier'.

Why is this not working?

The reason I want this is to be able to check which version of access is running. If it's 2003 use acFormatSNP, if it's any other use acFormatPDF

È stato utile?

Soluzione

You need to use the content of acFormatSNP, it is a built in constant, so:

Dim stype as Text
stype = "Snapshot Format (*.snp)"
''Or, no quotes
stype = acFormatSNP 
DoCmd.OutputTo acOutputReport, "table1", stype, "z:\docs\test.snp"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top