Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Please Help: Problem Working With Access From VB6 Application

Discussion in 'Information Technology' started by sasha, Jul 28, 2006.

  1. sasha

    Expand Collapse

    My VB 6 application works Access database. I've setup a reference
    project to Access Data Object.
    I've got two issues that I don't know how to resolve. Can anyone
    help? Also, if you can point me to a chapter in help or anywhere where
    I can read more on the subject. Search key words I came up with bring
    way to many unrelated results. Below are the two issues.
    1. At some point I displayed an Access form. When I change data in the
    form, they seemed to be successful. However, if I open the same
    database from Access, the changes I made from this form were not
    applied. If I re-display the from form my application, the form shows
    that the data was changed. It looks like if I make edits using form
    called from the VB6 application, they'd be kept in a separate copy of
    the database. What am I doing wrong?

    Here is the code:
    Dim AccessApp As Access.Application
    Set AccessApp = New Access.Application
    ' path to the database is the same as specified in properties of my
    project's data enviroment
    ' ex. D:\filename.mdb
    AccessApp.OpenCurrentDatabase _
    Dim sWhereCondition As String
    sWhereCondition = "[BATCH] = " & 4039
    AccessApp.DoCmd.OpenForm "BatchEdit", , , sWhereCondition
    AccessApp.Visible = True

    Set AccessApp = Nothing

    2. I was trying to print access report and it works fine with the below
    code. I also wanted to change a printer it goes to. However whatever
    ways I tried, it always went to a default printer. I've tried
    changing printer object, application.printer object, access.printer
    object - nothing had any effect.
    On Error GoTo ErrorHandler
    Dim AccessApp As Access.Application
    Set AccessApp = New Access.Application
    AccessApp.OpenCurrentDatabase _

    deShopFloor.conShopFloor.Properties("Data Source").Value
    AccessApp.Visible = True

    Dim sWhereCondition As String
    sWhereCondition = "[BATCH] = " & 4039
    AccessApp.DoCmd.OpenReport "Time Card", acViewNormal, ,
    AccessApp.DoCmd.OpenReport "Press", acViewPreview, , sWhereCondition

    Set AccessApp = Nothing

    Thank you,
  2. Loading...

    Similar Threads Forum Date
    Why Are There Different Versions Of Bhai Nand Lal's Rehitnama? Please Help Clarify Questions and Answers Mar 7, 2017
    General Help! Looking For A Good Clairvoyant/card Reader. Any Suggestions? Please Blogs Jan 25, 2016
    Please Help Questions and Answers Nov 1, 2013
    Please Help! What Is The Name Of The Narrator/Raagi? Gurbani Download Oct 16, 2012
    Muslim Girl-Sikh Boy Marriage Problems- Please Help! Love & Marriage Oct 12, 2012

Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     

Share This Page