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
    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
    Help Please :/ Relationships Apr 19, 2011

Share This Page