Exportwithformatting - getting filename from the value in a field in the report (1 Viewer)

JimOR

New member
Local time
Today, 08:19
Joined
Dec 15, 2023
Messages
3
I have a macro that brings up one selected page at a time and I want to save this as a pdf with a filename from a field "Invoice Ref" on the form. I have attached a screen shot. Ignore the SetVar bit - that was somenting I saw on one of the other posts, but it didn't work.
This macro will export the file but with the filename "[Invoice Ref]" I have tried all combinations of [ ] and ([ ]) without success. How can I specify that [Invoice Ref] is a value? No VBA please!
 

Attachments

  • Macro 2.png
    Macro 2.png
    16.1 KB · Views: 49

Gasman

Enthusiastic Amateur
Local time
Today, 08:19
Joined
Sep 21, 2011
Messages
14,299
In VBA you would concatenate the control value using &

I cannot get same to work in a 2007 macro, which I hardly ever use anyway.

Better get used to using VBA. Much more flexible than macros, and easier to use.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 08:19
Joined
Sep 21, 2011
Messages
14,299
This works

1702645613757.png

I just set a Tempvar as a test for a variable. You can use the form control with full form reference.
 

JimOR

New member
Local time
Today, 08:19
Joined
Dec 15, 2023
Messages
3
Sorry for the delay in responding, Gasman; a few things got in the way🎅 I have adapted my macro (see attachment) The result is that the Save dialogue box pops up. As the relevant record is also opened, it is easy enough to enter the Invoice Ref as the file name. Not perfect, but it will do for now. Can you see where I am going wrong?
Thanks for taking the time to help me. I have as started to look at VBA code but it's still very early days:eek:
Jim
 

Attachments

  • Macro 2A.png
    Macro 2A.png
    18.2 KB · Views: 48
  • Save File dialogue window.png
    Save File dialogue window.png
    24.9 KB · Views: 49

Gasman

Enthusiastic Amateur
Local time
Today, 08:19
Joined
Sep 21, 2011
Messages
14,299
I hardly ever use macros.
I also do not use spaces in tempvar names.
You set tempvar InvoiceRef, so use that in the output file field.
If you need a path, concatenate the tempvar value to the path.
I doubt Ready To Print is in the name of the report?
 

Users who are viewing this thread

Top Bottom