Chartspace Data Source and Connection String Problem

H

headly

I've embedded the activex chart control on a form. It needs to pull data from
an access database. When hardcoded into properties, the chart works fine, but
I'd like to dynamically be able to pull the data from whatever directory the
file may reside in.
Here's the code that isn't working, thoughts appreciated

'Create variable for connection string less path

Dim strConnection As String
'The access db has the same name as the workbook
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Left(ActiveWorkbook.FullName, Len(ActiveWorkbook.FullName) - 4) &
".mdb;Persist Security Info=False;Jet OLEDB:Database Password=;"

frmMain.ChartSpace1.ConnectionString = strConnection
frmMain.ChartSpace1.DataMember = "qryDJIA"
frmMain.ChartSpace1.Refresh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top