Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Please help: problem working with Access from VB6 application

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

  1. sasha

    sasha
    Expand Collapse
    Guest

    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 _
    deShopFloor.conShopFloor.Properties("Data
    Source").Value
    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, ,
    sWhereCondition
    AccessApp.DoCmd.OpenReport "Press", acViewPreview, , sWhereCondition

    AccessApp.CloseCurrentDatabase
    AccessApp.Quit
    Set AccessApp = Nothing

    Thank you,
    Alex
     
  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

Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page