Results 1 to 13 of 13

Thread: RobDog888

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12

    RobDog888

    Rob,

    Ok, I am having problems. New VB programmer wantabe! I have a Access Database (PMEL.mdb). I have a report (TestQuestions) that I want to print from that database.

    Ok, I have gotten to this point. Here is my code:

    Dim objACCESS As Object
    On Error Resume Next
    Set objACCESS = CreateObject("Access.Application")
    objACCESS.OpenCurrentDatabase filepath:="C:\PMEL.mdb"
    objACCESS.Visible = True

    DoCmd.OpenReport "TestQuestions", acViewPreview
    DoCmd.Maximize

    Now Access opens, but the Database does not! It will open the Report if I already have Access open. What the hell am I doing wrong? Thanks!

    RichMojo in the Sand Box!
    Last edited by RichMojo; Aug 4th, 2004 at 03:37 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You may want to install service pack 5 or 6 for vs first.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    When you want to reply to a question, click on "Post Reply" and not "New Thread".

    This works for me.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.  
    5.     Dim objACCESS As Access.Application
    6.     On Error Resume Next
    7.     Set objACCESS = CreateObject("Access.Application")
    8.     objACCESS.OpenCurrentDatabase "C:\PMEL.mdb"
    9.     objACCESS.Visible = True
    10.    
    11.     DoCmd.OpenReport "TestQuestions", acViewPreview
    12.     DoCmd.Maximize
    13.  
    14. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12

    Well...

    Rob,

    I only posted a new thread because I was not sure of how the board worked. You must have type a response as I was modifying my original thread. After I got done, I saw that you had replied. Not use to the boards. My BUST!

    It still only opened ACCESS and not the Database. I downloaded Service Pack 5 and then will download Service Pack 6 and see if that works. Thanks.

    Mojo

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob. Just let us know how it worked out for you.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12

    Well...

    ...Service packs 5 & 6 did not help. My Access opens, but no database is started. I also fount the missing DLL for the Data Environment 1.0, have it added, but nothing shows up under the project heading! Sure wish I had some books out here in Saudi!!!!

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You may need to restart vb or windows. Then go to Project > Add
    Data Report. Or go to Project > More ActiveX Designers > Data
    Enviroment.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12

    No Luck!

    Ok, tried that, No Luck. I can not get the Data Environment to show up. And I can not get Access to load MY Database. If I open up the database manually before hand, my code works. Of course that is just the beginning. Then I need to print a random test from the question bank. And if possible, print the answers in a random fashion for each question picked!

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Im no expert or MCSD, but this code should be working for you
    unless you are having an issue with your os, office, or vb.
    Maybe try posting a link to this thread in the Classic VB section to
    get more input on this?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10
    Junior Member
    Join Date
    Aug 2004
    Location
    Pune
    Posts
    19
    Originally posted by RobDog888
    When you want to reply to a question, click on "Post Reply" and not "New Thread".

    This works for me.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.  
    5.     Dim objACCESS As Access.Application
    6.     On Error Resume Next
    7.     Set objACCESS = CreateObject("Access.Application")
    8.     objACCESS.OpenCurrentDatabase "C:\PMEL.mdb"
    9.     objACCESS.Visible = True
    10.    
    11.     DoCmd.OpenReport "TestQuestions", acViewPreview
    12.     DoCmd.Maximize
    13.  
    14. End Sub
    ----------------------------------------
    the above code is not working the report window comes and immediatly goes tell me what is the porblem ??????????
    vaishu999

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Take out the "On Error Resume Next" and step through the code.
    You do have a valid report to open, correct?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12
    Junior Member
    Join Date
    Aug 2004
    Location
    Pune
    Posts
    19
    hi RobDog888

    see the following code
    Set oApp = New Access.Application
    Set objACCESS = CreateObject("Access.Application")
    objACCESS.OpenCurrentDatabase filepath:="C:\MshExtraterCurrent\bin\MshExtractor.mdb"

    objACCESS.RunCommand acCmdAppMaximize
    objACCESS.RunCommand acCmdWindowUnhide

    objACCESS.DoCmd.OpenReport "PID", View:=acViewPreview
    objACCESS.DoCmd.Maximize

    objACCESS.Visible = True
    objACCESS.RunCommand acCmdAppMaximize
    Set objACCESS = Nothing

    ------------------------------------------
    in above code it is opening access report the inner report window is maximized but the main outer application window can not get mazimised what is the reason please try the above code and tell me where i want to make changes

    thanks
    vaishali
    vaishu999

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    "objACCESS.RunCommand acCmdAppMaximize" doesn't work for
    the application window?
    Try maximizing before and after the report is opened?

    VB Code:
    1. objACCESS.DoCmd.Maximize
    2. objACCESS.DoCmd.OpenReport "PID", View:=acViewPreview
    3. objACCESS.DoCmd.Maximize
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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