rbrewington
08-07-2008, 03:23 PM
So, I don't think this was a problem before, but ever since I tried to organize some of my code for this project I haven't been able to get the userform to work after the initial time it is used by opening a template. The userforms are pulled up by a macro attached to the original .dot file upon opening or creating a new file and it works when you initially open the .dot file to create a new .doc file. Unfortunately it does not work when I open an existing .doc file based on the original template and for some reason gives a file doesn't exist error when an external database is called for. I've been trying to figure this out all day and I'm guessing it's simple 'cause it was working OK before, but I can't figure out what changed or what the problem is for the life of me. The bit of code I'm posting is where this all gets stuck. The file in question (Psychiatry.mdb) exists and this works when initially running the template file it's attached to, but then later will not work after it is saved as a .doc from the template. Anyone willing to take a look?
Thanks,
Ryan
' This code activates the Database connection. Change
' the path to reflect your database.
Set dbDatabase = OpenDatabase(ActiveDocument.Path & "C:\Documents and Settings\Ryan\My Documents\Records\Templates\Psychiatry.mdb")
Thanks,
Ryan
' This code activates the Database connection. Change
' the path to reflect your database.
Set dbDatabase = OpenDatabase(ActiveDocument.Path & "C:\Documents and Settings\Ryan\My Documents\Records\Templates\Psychiatry.mdb")