Results 1 to 3 of 3

Thread: Changing Database at Runtime-Urgent

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Location
    Al-Khobar
    Posts
    7

    Unhappy Changing Database at Runtime-Urgent

    Hi,
    I am using VB 6.0(ADO Method)/MS-Access, Crystal 8.5 (through Active X Control i.e Crystl32.OCX) and create reports through DSN. As of now I have worked on 1 Database and bind all the Reports at design to DSN and DSN is connected to the Database.

    Now I have 4 - 5 Database or databases may increase as per the need. Tables in all the Databases are same only Data is different but Reports for all the Database is same.

    When VB Application starts users is asked to select Database. All the Data and records goes to selected Database. I want that when I run the report. Reports should retrieve the Records from selected Database Only. Whenever Database is changed Reports should retrieve the data from the selected Database.

    Pls advise me How Database Can be changed at run time or how to bind reports. Actually, This practice is done in Multi-Company System. Suppose, there is Payroll Package which keeps records of Head office and 3 Branches. So, 4 Databases will be created or when any new branch open Database may increase but Reports will be same for all.

    Kindly help me.

    Regards,

    Sohrab
    Sohrab.ahmad@alfozan.com

    Changing Database at Runtime-Urgent

  2. #2
    New Member
    Join Date
    Oct 2004
    Location
    Adelaide, South Australia
    Posts
    1
    Make sure all your ODBC connections are defined for System DSN.
    You can't mix and match, for example, between File DSN and System DSN - all must be of type System.

    [form.]Report.Connect = "DataSourceName";"UserID";"Password";"DatabaseName"
    (only need to uses DatabaseName above if your server uses the database concept)

    Report.SetTableLocation "databasename.mdb", "TableName", "Buffer"
    (usually can leave Buffer as empty string)

    the schema and fields need to be the same in each database to achieve this, as Crystal essentially uses a snapshot of the table structure at design time and works out the offsets to the required fields to obtain the data, and if you have different structures, you'll have problems. So as long as the table format (fields, types etc) is the same across all databases, it should work.

    Good luck

    Dave
    "The smoker you drink, the player you get" - Joe Walsh

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Location
    Al-Khobar
    Posts
    7

    Changing Database at Runtime

    Mr. Dave,
    Thanks for your reply,

    Boss I did not understand about All ODBC Connection. Right now I have 1 ODBC connection and that is SYSTEM DSN.

    [form.]Report.Connect = "DataSourceName";"UserID";"Password";"DatabaseName"
    (only need to uses DatabaseName above if your server uses the database concept)

    Report.SetTableLocation "databasename.mdb", "TableName", "Buffer"
    (usually can leave Buffer as empty string)

    Iused this code but I'm uanble to find Report.SetTableLocation Property.
    I'm using Crystal Control Object (Crystl32.OCX) where .SetTableLocation Property is not available.

    In All the Database Schema and Fileds everything is same only Database Names are different b'coz data save in different databases.

    Pls do something. I'll be highly grateful to you.

    Regards,
    Sohrab

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