|
-
Aug 23rd, 2004, 12:46 AM
#1
Thread Starter
Fanatic Member
SetLogOnInfo ( Resolved )
I am using the following function to set the datapath of the tables used in a crystal report at runtime.
access is being used as the database
the SetLogOnInfo statement is not working.
Set rep_application = Nothing
Set rep_application = New CRAXDRT.Application
Dim rep As New CRAXDRT.Report
Set rep = rep_application.OpenReport(App.Path & "\reports\" & RepName, crOpenReportByTempCopy)
rep.VerifyOnEveryPrint = True
Dim DataPath As String
DataPath = "c:\myapp\database\"
dim password as string
password="mypassword"
Dim counter As Integer
Dim str_DataFile As String
Dim DataFiles As New CRAXDRT.DatabaseTables
Set DataFiles = rep.Database.Tables
For counter = 1 To DataFiles.count
str_DataFile = returnFileName(DataFiles(counter).Location) '' this returnFileName function returns the filename from the fullpath
DataFiles(counter).SetLogOnInfo "msaccess", DataPath & str_DataFile, , password
Next
SmartViewer.ReportSource = rep
SmartViewer.ViewReport
Last edited by vishalmarya; Nov 6th, 2004 at 10:46 AM.
-
Aug 23rd, 2004, 05:48 PM
#2
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 25th, 2004, 04:38 AM
#3
Thread Starter
Fanatic Member
No error is generated .
it does not sets The database new location .
it remains the default ( as set in crystal reports reprot creater )
-
Aug 25th, 2004, 11:18 AM
#4
Try passing a ADO recordset to the reportsource. This always works for me.
VB Code:
'oRs is an adodb.recordset
'oReport is a open cr report object
oReport.Database.SetDataSource oRs, 3, 1
crvViewer.ReportSource = oReport
crvViewer.ViewReport
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 26th, 2004, 04:43 AM
#5
Thread Starter
Fanatic Member
Still Not Working !
Actually i am working on tables collection of database object of OReport
so it goes like this .
OReport.Database.Tables(1).SetDataSource oRs,3
I don't know what this datatag is ?
after the statement , if location property is verified , it gives the old path.
OReport.Database.Tables(1).location
so setdatasource statement seems to have no affect
-
Sep 1st, 2004, 04:07 AM
#6
Thread Starter
Fanatic Member
-
Nov 3rd, 2004, 07:58 PM
#7
Hyperactive Member
Have you got this solved yet?
I may have the answer.
FW
-
Nov 4th, 2004, 03:12 AM
#8
Thread Starter
Fanatic Member
-
Nov 4th, 2004, 05:49 PM
#9
Hyperactive Member
The problem I had was that when I built the report I set it up to read Access. The default for this situation is that the report is set up to use a DAO recordset. When I tried to pass it an ADO recordset, it didn't work. What I did to fix is was to delete the original reference to the Access database, ands add it again using ADO.
To do this I right clicked on the database node in the pane to the left and clicked on Add database. I then chose the Use SQL button. This enabled me to set the report to use an ADO recordset. Then when I used SetDataSource and set it to and ADO recordset the problem was solved.
Hope this Helps
FW
-
Nov 5th, 2004, 06:20 AM
#10
Thread Starter
Fanatic Member
Yes that solved the problem .
Thanks a Lot.
in case of "data file" option which i was using till now
i was able to choose multiple tables in one go from a database
But in case i am using (SQl/odbc)-->ADO , i am not able to do that .
it asks for alias every time i want to add some differnt table from the database . I am a little confused !
-
Nov 7th, 2004, 05:43 PM
#11
Hyperactive Member
Glad to help. This all seems to be a fairly poorly understood. I had real trouble getting info from the forums too. I think we would all appreciated you updating this thread if you do sort out the last bit of the puzzle that's confusing you.
FW
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|