Results 1 to 11 of 11

Thread: SetLogOnInfo ( Resolved )

  1. #1

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    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.
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    What is the error?
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  3. #3

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858
    No error is generated .

    it does not sets The database new location .

    it remains the default ( as set in crystal reports reprot creater )
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Try passing a ADO recordset to the reportsource. This always works for me.
    VB Code:
    1. 'oRs is an adodb.recordset
    2. 'oReport is a open cr report object
    3. oReport.Database.SetDataSource oRs, 3, 1
    4. crvViewer.ReportSource = oReport
    5. 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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  5. #5

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858
    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
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  6. #6

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858
    Can Any One Help !
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  7. #7
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    Have you got this solved yet?

    I may have the answer.

    FW

  8. #8

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858
    No I haven't .
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  9. #9
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    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

  10. #10

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858
    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 !
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  11. #11
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    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
  •  



Click Here to Expand Forum to Full Width