Solved

VB.net need to open Access DB, then Open Form

Posted on 2004-08-24
4
329 Views
Last Modified: 2012-08-14
Ok, I would like a simple way to create a Windows Application in VB.net, which, when opened, will:

1.Open an Access DB
2. When a button is clicked, open a form.

I have tried the following to open the form:

----------------------------
    Dim oAccess As Application
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        oAccess.DoCmd.OpenForm(FormName:="Visit", _
   View:=Access.AcFormView.acNormal)
------------------------------------------

But this gives me an error saying "‘DoCmd’ is not a member of ‘System.Windows.Forms.Application’"

I also added the reference from the COM tab, Microsoft Access 10.0 Object Library.


Please help!
Thanks.
0
Comment
Question by:DragonReborn214
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 14

Expert Comment

by:ptakja
ID: 11886578
To open a form you do something like this:

Dim Myfrm As New Form1  ' Form1 or whatever you called your form
Myfrm.Show()   'Will display the form.
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 11886595
DoCmd is no longer supported in vb.net

if you want to open an executable program, youll have to do something like this

Shell("C:/your_path/your_database.mdb")

to open a form, (im assuming a vb.net form, not an access form) you need to

Dim frm As New Form1
Form1.ShowDialog

if you mean you want to open an Access form, youll have to open the form with an Access command, dont remember how to do it, but on the load of the database, you can have a form load.....which will have nothing to do with any vb.net code.  

in fact i dont think you can open an access form with vb.net code...

~b
0
 

Author Comment

by:DragonReborn214
ID: 11886627
I am trying to open an access form.

This article kind of goes into detail, but I am not able to do the doCmd

http://support.microsoft.com/default.aspx?scid=kb%3BEN-US%3B317113

0
 
LVL 2

Accepted Solution

by:
Mehrdad_Y earned 50 total points
ID: 11895792
You have to use office automation.
To do this, make a reference to Microsoft Access 10 or 11 Object Library
Define a variable of type: Microsoft.Office.Interop.Access.Application
Construct it. (Use the "New" keyword)
Make it to open your MDB file.
Now you can use the docmd
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question