Results 1 to 5 of 5

Thread: Access & VB problem

  1. #1

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565

    Question

    Thought I'd posted this earler, but seems to have disappeared.

    Anyway can somebody out there let me know how to utilise Access Reports in a secured database from VB.

    This will save me tonnes of work, so please help me out here.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  2. #2
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Ensure you have a reference set to Access in your project then do the following:

    Dim appAccess as Access.Application

    Set appAccess = New Access.Application

    appAccess.OpenCurrentDatabase "Full Path Here", False

    appAccess.DoCmd.OpenReport "Name", View, Filter, Where...

    Look up OpenReport in help from VB for more info on the parameters.

    I can't remember how to send the username and password but I've done it before so if it's any consolation to you it is possible. Do a search for posts from me on this site as I beleive I posted the same question here a long time back.

    Best regards,

    Rob Brown.

  3. #3

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Cheers, thats what I have been doing, but I haven't figured out how to send the username and password yet.

    I wonder if there is a way to do it with using a data source name.

    I'll have a search through your posts.

    Cheers again.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  4. #4
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Found It!

    After creating your new Access application but before invoking the OpenCurrentDatabase method, slop in the following

    appAccess.DBEngine.DefaultUser="Your access user name"
    appAccess.DBEngine.DefaultPassword="Your access password"

    Hope that clears it up for you.

    Best regards,

    Rob Brown.

  5. #5

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Cheers yet again!!

    I'll try it out.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

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