GetRegistryString which dll?

  • Thread starter Thread starter Pat G
  • Start date Start date
It's not a standard win32 DLL function AFAIK.

What has this got to do with Microsoft Access (the topic of this newgroup)?

HTH,
TC
 
I'm trying to run this sub but it says GetRegistryString
is undefined as a funciton or sub.

Public Sub RunReportAsPDF()
On Error GoTo Err_RunReport

'Folder where PDF file will be written
sPDFPath = "C:\myapp\archive\"

'Save current default printer
sMyDefPrinter = GetRegistryString
(HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device")
' Set default printer to PDF Writer
SaveRegistryString
HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter"

sPDFName = "Report.pdf"
' Setting value for PDFFileName in the registry stops
file dialog box from appearing
SaveRegistryString
HKEY_CURRENT_USER, "Software\Adobe\Acrobat
PDFWriter", "PDFFileName", sPDFPath + sPDFName

' Run the report
DoCmd.OpenReport "Report", acPreview

Exit_RunReport:
' Restore default printer
SaveRegistryString
HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device", sMyDefPrinter
Exit Sub

Err_RunReport:
MsgBox Err.Description
Resume Exit_RunReport

End Sub
 
Pat G said:
I'm trying to run this sub but it says GetRegistryString
is undefined as a funciton or sub.

Public Sub RunReportAsPDF()
On Error GoTo Err_RunReport

'Folder where PDF file will be written
sPDFPath = "C:\myapp\archive\"

'Save current default printer
sMyDefPrinter = GetRegistryString
(HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device")
' Set default printer to PDF Writer
SaveRegistryString
HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter"

sPDFName = "Report.pdf"
' Setting value for PDFFileName in the registry stops
file dialog box from appearing
SaveRegistryString
HKEY_CURRENT_USER, "Software\Adobe\Acrobat
PDFWriter", "PDFFileName", sPDFPath + sPDFName

' Run the report
DoCmd.OpenReport "Report", acPreview

Exit_RunReport:
' Restore default printer
SaveRegistryString
HKEY_CURRENT_USER, "Software\Microsoft\WIndows
NT\CurrentVersion\Windows", "Device", sMyDefPrinter
Exit Sub

Err_RunReport:
MsgBox Err.Description
Resume Exit_RunReport

End Sub

I'm not sure where your code came from, but there's code to read the
registry to be found at:

http://www.mvps.org/access/api/api0015.htm

That code doesn't incude to write the registry, which the routine
"SaveRegistry" is supposed to do, so you'll have to poke around a bit
more. It occurs to me, though, that if you copied that code from
somewhere, the GetRegistryString and SaveRegistry routines are probably
available from the same location.
 
GetRegistryString() would be a local function written by the person who
wrote the other parts of your code. Ie. you have got >some< of the code, but
not all of it. Go back where you got the original code, & try to find the
rest of it. Or, as Dirk suggested, get code from some other place, that will
read string values from the registry, then use that code to write your own
GetRegistryString function.

HTH,
TC
 
Back
Top