Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-24
4
Medium Priority
?
338 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 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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