I know this is old technology, but I have to update an old program to work temporarily while it is being rewritten. I have a couple of issues.
It was viewing files with no problems. It used the Connect property to change the datasource when running the reports. Designs are done on different databases, either text or MySQL. Now there has been a request to support the dynamic changing of databases for subreports that are different from main reports. So the users wish to have reports that the main report is run off the MS Access text driver and subreports that run from MySQL ODBC driver (or other combinations).
So I was trying to figure out if a given report may have a subreport that is MySQL or Text. I was testing if the .RetrieveLogonInfo command will give me the information I need (DSN Name) and now I am getting a message that I cannot use the LogonInfo and Connect at the same time.
Problem 1:
I am not able to get the proper DSN from the .RetrieveLogonInfo command for the subreports using the following code.
intNumSubs = crReports.GetNSubreports
For x = 0 To intNumSubs - 1
sConnect = ""
title = crReports.GetNthSubreportName(x)
With crReports
.SubreportToChange = title
number = .RetrieveLogonInfo
strCurrentConnect = .LogonInfo(0) 'still giving me the main report DSN
sConnect = GetReportDSN(strCurrentConnect)
For y = 0 To number
crReports.LogonInfo(y) = sConnect 'replaced .Connect = sConnect with this for loop
Next y
Debug.Print strCurrentConnect
' '.Connect = sConnect
End With
Next x
I've made a couple of notes in the code above. When the main report is the text driver and the subreport is MySQL, the subreport .LogonInfo(0) will not give me the correct information.
Second Problem:
If I can get the proper information, what is the proper way to use the .LogonInfo command to reset the information once I figure out which one it should be (text or MySQL)?
If anyone has any insight, I would appreciate some help. If you need more info, I can do that too. TIA rasinc.