|
-
Aug 4th, 2004, 11:44 AM
#1
Thread Starter
New Member
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.
-
Aug 4th, 2004, 03:33 PM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 4th, 2004, 04:33 PM
#3
When you want to reply to a question, click on "Post Reply" and not "New Thread".
This works for me.
VB Code:
Option Explicit
Private Sub Command1_Click()
Dim objACCESS As Access.Application
On Error Resume Next
Set objACCESS = CreateObject("Access.Application")
objACCESS.OpenCurrentDatabase "C:\PMEL.mdb"
objACCESS.Visible = True
DoCmd.OpenReport "TestQuestions", acViewPreview
DoCmd.Maximize
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 5th, 2004, 12:46 AM
#4
Thread Starter
New Member
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
-
Aug 5th, 2004, 11:01 AM
#5
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 5th, 2004, 11:15 AM
#6
Thread Starter
New Member
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!!!!
-
Aug 5th, 2004, 11:29 AM
#7
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 5th, 2004, 01:06 PM
#8
Thread Starter
New Member
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!
-
Aug 5th, 2004, 02:09 PM
#9
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 25th, 2004, 02:46 AM
#10
Junior Member
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:
Option Explicit
Private Sub Command1_Click()
Dim objACCESS As Access.Application
On Error Resume Next
Set objACCESS = CreateObject("Access.Application")
objACCESS.OpenCurrentDatabase "C:\PMEL.mdb"
objACCESS.Visible = True
DoCmd.OpenReport "TestQuestions", acViewPreview
DoCmd.Maximize
End Sub
----------------------------------------
the above code is not working the report window comes and immediatly goes tell me what is the porblem ??????????
-
Aug 25th, 2004, 11:20 AM
#11
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 25th, 2004, 11:05 PM
#12
Junior Member
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
-
Aug 26th, 2004, 04:02 PM
#13
"objACCESS.RunCommand acCmdAppMaximize" doesn't work for
the application window?
Try maximizing before and after the report is opened?
VB Code:
objACCESS.DoCmd.Maximize
objACCESS.DoCmd.OpenReport "PID", View:=acViewPreview
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|