I'll start off saying I am not a programmer. I am making a database that imports data from Word forms. It requires code and I found some that works almost perfectly for me at http://msdn.microsoft.com/en-us/library/aa155434(office.10).aspx
It does exactly what I need. The only thing that would make this code better would be to use relative references to the database and imported files.
strDocName = "C:\Contracts\" & _ InputBox("Enter the name of the Word contract " & _ "you want to import:", "Import Contract") Set appWord = GetObject(, "Word.Application") Set doc = appWord.Documents.Open(strDocName) cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\My Documents\" & _ "Healthcare Contracts.mdb;" rst.Open "tblContracts", cnn, _ adOpenKeyset, adLockOptimistic
In a previous database, I was able to use CurrentProject.Path to allow for relative paths, but I can't figure out how to get that to work with this code.
Can anyone please help me by letting me know how to set up a relative path for the referencing. I am planning on storing the database and files to be imported in the same folder.