View Single Post
 
Old 07-03-2012, 08:23 AM
marooned's Avatar
marooned marooned is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Jul 2012
Location: Caribbean
Posts: 2
marooned is on a distinguished road
Default get access database path in Word vba

Hi all
I am trying access database to fill a word document. It works fine as I have it now.
I am accessing Access data base as below:

Code:
Dim dbDatabase As Database
Dim rsMedico As Recordset
Dim i As Integer
Dim aResults()
 
Set dbDatabase = OpenDatabase("C:\Users\Rama\Documents\Medprog\Medico.mdb")
 
Set rsMedico = dbDatabase.OpenRecordset("Patients", dbOpenSnapshot)
Instead of hard coding as above I like to get db path by code or connect string. I have tried all like getdbpath, getdbfullpath. I get errors like type mismatch,object variable not set etc.

I need a relative path or soft coding so that I can use this any other computer with access database.
Hope somebody can help

Marooned

Last edited by macropod; 07-04-2012 at 01:55 AM. Reason: Added code tags
Reply With Quote