OzoneFriendly
asked on
Need to set registry keys programatically in Access
Hello Experts;
I am trying to do some automatic PDFing in access, and have this to go on;
http://www.cutepdf.com/Solutions/pdfwriter3.asp
However, that code doesn't work in my Access Database.
Can anyone show me the right code to do it within Access?
I am trying to do some automatic PDFing in access, and have this to go on;
http://www.cutepdf.com/Solutions/pdfwriter3.asp
However, that code doesn't work in my Access Database.
Can anyone show me the right code to do it within Access?
ASKER
Sorry, I should have been more specific;
I don't want to use word; What I want to do is have the program automatically create a PDF copy of a report I have created in Access.
I have all the code necessary to find the right data and open the report, and I should be able to change that code to print instead of open the report;
I just need to be able to set a couple of registry keys so that the PDF software will automatically save the PDF where I want with the name I want.
I'll have a look at your link though and see what I can learn there.
I don't want to use word; What I want to do is have the program automatically create a PDF copy of a report I have created in Access.
I have all the code necessary to find the right data and open the report, and I should be able to change that code to print instead of open the report;
I just need to be able to set a couple of registry keys so that the PDF software will automatically save the PDF where I want with the name I want.
I'll have a look at your link though and see what I can learn there.
If so, install a pdf printer like this (free, uses Apple Postscript and Ghostscipt and comes with a multi lingual UI):
http://freepdfxp.de/fpxp.htm
and select that as your default printer or set the report to use that printer.
Another method is to use snapshot files and the code from Lebans:
http://www.lebans.com/reporttopdf.htm
Also, search the archive here for writing/printing to pdf. Numerous suggestions exist.
/gustav
http://freepdfxp.de/fpxp.htm
and select that as your default printer or set the report to use that printer.
Another method is to use snapshot files and the code from Lebans:
http://www.lebans.com/reporttopdf.htm
Also, search the archive here for writing/printing to pdf. Numerous suggestions exist.
/gustav
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello experts;
Thanks for your suggestions; I have purchased the CutePDF solution, so now I just need to figure out the registry key setting code, and I should be all good. I'l look into LSMConsulting's suggestions now and see what I come up with.
Thanks for your suggestions; I have purchased the CutePDF solution, so now I just need to figure out the registry key setting code, and I should be all good. I'l look into LSMConsulting's suggestions now and see what I come up with.
If you have the CutePDF with Programatic Acces, then you can use the code shown in your earlier code. Note that you must also have a converter:
PDF writer requires PS2PDF converter such as GPL Ghostscript (recommended).
The utility used to ship with this converter, but it's a separate download now.
PDF writer requires PS2PDF converter such as GPL Ghostscript (recommended).
The utility used to ship with this converter, but it's a separate download now.
ASKER
Thanks LSMConsulting!
The answer to my question was certainly not a one line paragraph as I had hoped, but your pointers got me on the right track.
With the help of these questions;
https://www.experts-exchange.com/questions/21082306/Access-2003-create-a-registry-entry.html?sfQueryTermInfo=1+kei+lsmconsult+registri
https://www.experts-exchange.com/questions/20884446/Modifying-Registry-Write-script.html?query=lsmconsulting+registry&clearTAFilter=true
https://www.experts-exchange.com/questions/20881639/Free-Control-for-reading-writing-to-registry.html
I found this link;
http://www.freevbcode.com/ShowCode.asp?ID=314
And used that stuff to make it work. I incorporated the .bas file as a module in my access database, and could then use this code to set the registry keys;
regCreate_A_Key HKEY_CURRENT_USER, "Software\PDF Creator"
regCreate_Key_Value HKEY_CURRENT_USER, "Software\PDF Creator", "Outputfile", "c:\poles\inv.pdf"
regCreate_A_Key HKEY_CURRENT_USER, "Software\PDF Creator"
regCreate_Key_Value HKEY_CURRENT_USER, "Software\PDF Creator", "BypassSaveAs", "1"
I had to make one minor change to the .bas code I got, as it was setting up the registry value as a DWORD if the data was numeric; CutePDF wants on REG_SZ. So I just made it always create REG_SZ, which is fine for this application.
Sensational. :-)
Thanks for your help.
The answer to my question was certainly not a one line paragraph as I had hoped, but your pointers got me on the right track.
With the help of these questions;
https://www.experts-exchange.com/questions/21082306/Access-2003-create-a-registry-entry.html?sfQueryTermInfo=1+kei+lsmconsult+registri
https://www.experts-exchange.com/questions/20884446/Modifying-Registry-Write-script.html?query=lsmconsulting+registry&clearTAFilter=true
https://www.experts-exchange.com/questions/20881639/Free-Control-for-reading-writing-to-registry.html
I found this link;
http://www.freevbcode.com/ShowCode.asp?ID=314
And used that stuff to make it work. I incorporated the .bas file as a module in my access database, and could then use this code to set the registry keys;
regCreate_A_Key HKEY_CURRENT_USER, "Software\PDF Creator"
regCreate_Key_Value HKEY_CURRENT_USER, "Software\PDF Creator", "Outputfile", "c:\poles\inv.pdf"
regCreate_A_Key HKEY_CURRENT_USER, "Software\PDF Creator"
regCreate_Key_Value HKEY_CURRENT_USER, "Software\PDF Creator", "BypassSaveAs", "1"
I had to make one minor change to the .bas code I got, as it was setting up the registry value as a DWORD if the data was numeric; CutePDF wants on REG_SZ. So I just made it always create REG_SZ, which is fine for this application.
Sensational. :-)
Thanks for your help.
Then, the registry functions must be declared in your code module.
Browse here to the comment from "James":
http://forums.devx.com/archive/index.php/t-67287.html
/gustav