문제

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

도움이 되었습니까?

해결책

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"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top