473,692 Members | 2,533 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open a Microsoft Access form

Hi,

How do I open a Microsoft Access 2003 form from Visual Basic.net

Thanks in advance
bbdobuddy

Nov 21 '05 #1
4 12274
bb

These kind of questions are mostly answered by Paul Clement.

Until he is awake/(active in this newsgroup) a message from him about your
question.

http://groups-beta.google.com/group/...eb9b56a39c4392

I hope this helps so far.

Cor
Nov 21 '05 #2
On Tue, 8 Feb 2005 15:47:03 -0800, bbdobuddy <bb*******@disc ussions.microso ft.com> wrote:

¤ Hi,
¤
¤ How do I open a Microsoft Access 2003 form from Visual Basic.net
¤

I used the Office PIA
(http://msdn.microsoft.com/library/de...HV01083002.asp)
for this but you can also use the interop assembly generated when you add the Access COM reference
to your project:
Public Sub AutomateAccess( )

Dim AccessApplicati on As New Microsoft.Offic e.Interop.Acces s.Application

If Not AccessApplicati on.Visible = True Then
AccessApplicati on.Visible = True
End If

AccessApplicati on.OpenCurrentD atabase("e:\My Documents\db1.m db")
AccessApplicati on.DoCmd.OpenFo rm("MyAccessFor mName",
Microsoft.Offic e.Interop.Acces s.AcFormView.ac Normal)

'...
'...

AccessApplicati on.Quit()

End Sub
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #3
I'm trying to use similar code as you used below, however, as mentioned in
the link you provided, the PIAs are not to be used in the application setup
process. If I don't include them in the setup then this code wont run on
the client. If I do include them in the setup, the code will run on the
client, but 1) the msdn documentation says we don't have the right to
distribute these, and 2) by installing these on the client we could corrupt
the office registration on the client when they do an un-install of our
applications. I was confused by the documentation in the URL as it didn't
clarify how to distribute the .net app and have the client be able to use
the code you listed below.

Do you have any advise on how to go about this?

Here's me code which is similar to your code:
Public Function OpenApp() As FileMngr
Try
Dim sFile As String = "some path to ms access"

Dim sCrit As New StringBuilder
Dim dr As wsMain.dsUser.t bCtlRow
sCrit = "some stuff for access to use"
'Startup Access Now
Dim AccessApplicati on As New Access.Applicat ion
'Make it visible ?should we do this later?
If Not AccessApplicati on.Visible = True Then
AccessApplicati on.Visible = True
End If
'Open app
AccessApplicati on.OpenCurrentD atabase(sFile)
'Call a function to start things running and pass in the user rights
that will be used to initalize everything
AccessApplicati on.Run("Main", sCrit.ToString)
Return FileMngr.Succes s

Catch ex As Exception
ErrLog(ex)
End Try
End Function
The msdn documentaion said to set the property (Copy Local) on the reference
to access to "False". When I did that, I get the following error:

System.IO.FileN otFoundExceptio n: File or assembly name Interop.Access, or
one of its dependencies, was not found.
File name: "Interop.Access "
at TransAct.Client AppHelper.OpenA pp()
at TransAct.frmMai n.OpenClientApp () in
D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\frm Main.vb:line 553

=== Pre-bind state information ===
LOG: DisplayName = Interop.Access, Version=9.0.0.0 , Culture=neutral ,
PublicKeyToken= null
(Fully-specified)
LOG: Appbase = D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\bin \
LOG: Initial PrivatePath = NULL
Calling assembly : TransAct, Version=1.0.188 7.28847, Culture=neutral ,
PublicKeyToken= null.
===

LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.Access, Version=9.0.0.0 ,
Culture=neutral , PublicKeyToken= null
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. DLL.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. DLL.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. EXE.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. EXE.
</Exception>
</Errors>
<Errors d2p1:id="2" d2p1:TimeStamp= "2005-03-02T16:10:40.691 6071-06:00"
xmlns:d2p1="htt p://tempuri.org/dsErrorHandler. xsd">
<Exception>Syst em.IO.FileNotFo undException: File or assembly name
Interop.Access, or one of its dependencies, was not found.
File name: "Interop.Access "
at TransAct.Client AppHelper.OpenA pp()
at TransAct.frmMai n.OpenClientApp () in
D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\frm Main.vb:line 553

=== Pre-bind state information ===
LOG: DisplayName = Interop.Access, Version=9.0.0.0 , Culture=neutral ,
PublicKeyToken= null
(Fully-specified)
LOG: Appbase = D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\bin \
LOG: Initial PrivatePath = NULL
Calling assembly : TransAct, Version=1.0.188 7.28847, Culture=neutral ,
PublicKeyToken= null.
===

LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.Access, Version=9.0.0.0 ,
Culture=neutral , PublicKeyToken= null
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. DLL.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. DLL.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. EXE.
LOG: Attempting download of new URL
file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. EXE.

Thanks for any help anyone can offer.

--
mo*******@nospa m.com
"Paul Clement" <Us************ ***********@sws pectrum.com> wrote in message
news:05******** *************** *********@4ax.c om...
On Tue, 8 Feb 2005 15:47:03 -0800, bbdobuddy
<bb*******@disc ussions.microso ft.com> wrote:

¤ Hi,
¤
¤ How do I open a Microsoft Access 2003 form from Visual Basic.net
¤

I used the Office PIA
(http://msdn.microsoft.com/library/de...HV01083002.asp)
for this but you can also use the interop assembly generated when you add
the Access COM reference
to your project:
Public Sub AutomateAccess( )

Dim AccessApplicati on As New
Microsoft.Offic e.Interop.Acces s.Application

If Not AccessApplicati on.Visible = True Then
AccessApplicati on.Visible = True
End If

AccessApplicati on.OpenCurrentD atabase("e:\My Documents\db1.m db")
AccessApplicati on.DoCmd.OpenFo rm("MyAccessFor mName",
Microsoft.Offic e.Interop.Acces s.AcFormView.ac Normal)

'...
'...

AccessApplicati on.Quit()

End Sub
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #4
On Wed, 2 Mar 2005 16:30:03 -0600, "moondaddy" <mo*******@nosp am.com> wrote:

¤ I'm trying to use similar code as you used below, however, as mentioned in
¤ the link you provided, the PIAs are not to be used in the application setup
¤ process. If I don't include them in the setup then this code wont run on
¤ the client. If I do include them in the setup, the code will run on the
¤ client, but 1) the msdn documentation says we don't have the right to
¤ distribute these, and 2) by installing these on the client we could corrupt
¤ the office registration on the client when they do an un-install of our
¤ applications. I was confused by the documentation in the URL as it didn't
¤ clarify how to distribute the .net app and have the client be able to use
¤ the code you listed below.
¤
¤ Do you have any advise on how to go about this?
¤
¤ Here's me code which is similar to your code:
¤
¤
¤ Public Function OpenApp() As FileMngr
¤ Try
¤ Dim sFile As String = "some path to ms access"
¤
¤ Dim sCrit As New StringBuilder
¤ Dim dr As wsMain.dsUser.t bCtlRow
¤ sCrit = "some stuff for access to use"
¤ 'Startup Access Now
¤ Dim AccessApplicati on As New Access.Applicat ion
¤ 'Make it visible ?should we do this later?
¤ If Not AccessApplicati on.Visible = True Then
¤ AccessApplicati on.Visible = True
¤ End If
¤ 'Open app
¤ AccessApplicati on.OpenCurrentD atabase(sFile)
¤ 'Call a function to start things running and pass in the user rights
¤ that will be used to initalize everything
¤ AccessApplicati on.Run("Main", sCrit.ToString)
¤ Return FileMngr.Succes s
¤
¤ Catch ex As Exception
¤ ErrLog(ex)
¤ End Try
¤ End Function
¤
¤
¤ The msdn documentaion said to set the property (Copy Local) on the reference
¤ to access to "False". When I did that, I get the following error:
¤
¤
¤
¤ System.IO.FileN otFoundExceptio n: File or assembly name Interop.Access, or
¤ one of its dependencies, was not found.
¤ File name: "Interop.Access "
¤ at TransAct.Client AppHelper.OpenA pp()
¤ at TransAct.frmMai n.OpenClientApp () in
¤ D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\frm Main.vb:line 553
¤
¤ === Pre-bind state information ===
¤ LOG: DisplayName = Interop.Access, Version=9.0.0.0 , Culture=neutral ,
¤ PublicKeyToken= null
¤ (Fully-specified)
¤ LOG: Appbase = D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\bin \
¤ LOG: Initial PrivatePath = NULL
¤ Calling assembly : TransAct, Version=1.0.188 7.28847, Culture=neutral ,
¤ PublicKeyToken= null.
¤ ===
¤
¤ LOG: Policy not being applied to reference at this time (private, custom,
¤ partial, or location-based assembly bind).
¤ LOG: Post-policy reference: Interop.Access, Version=9.0.0.0 ,
¤ Culture=neutral , PublicKeyToken= null
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. DLL.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. DLL.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. EXE.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. EXE.
¤ </Exception>
¤ </Errors>
¤ <Errors d2p1:id="2" d2p1:TimeStamp= "2005-03-02T16:10:40.691 6071-06:00"
¤ xmlns:d2p1="htt p://tempuri.org/dsErrorHandler. xsd">
¤ <Exception>Syst em.IO.FileNotFo undException: File or assembly name
¤ Interop.Access, or one of its dependencies, was not found.
¤ File name: "Interop.Access "
¤ at TransAct.Client AppHelper.OpenA pp()
¤ at TransAct.frmMai n.OpenClientApp () in
¤ D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\frm Main.vb:line 553
¤
¤ === Pre-bind state information ===
¤ LOG: DisplayName = Interop.Access, Version=9.0.0.0 , Culture=neutral ,
¤ PublicKeyToken= null
¤ (Fully-specified)
¤ LOG: Appbase = D:\nwis\Apps\La ndMan\VS\TransA ct\TransAct\bin \
¤ LOG: Initial PrivatePath = NULL
¤ Calling assembly : TransAct, Version=1.0.188 7.28847, Culture=neutral ,
¤ PublicKeyToken= null.
¤ ===
¤
¤ LOG: Policy not being applied to reference at this time (private, custom,
¤ partial, or location-based assembly bind).
¤ LOG: Post-policy reference: Interop.Access, Version=9.0.0.0 ,
¤ Culture=neutral , PublicKeyToken= null
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. DLL.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. DLL.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access. EXE.
¤ LOG: Attempting download of new URL
¤ file:///D:/nwis/Apps/LandMan/VS/TransAct/TransAct/bin/Interop.Access/Interop.Access. EXE.
¤
¤
¤
¤ Thanks for any help anyone can offer.

The references above are not to the Office PIAs but to the generic interop assemblies that are
created at design-time by the Visual Studio .NET IDE when you add one of the Office applications to
your project.

You should be able to deploy those interop assemblies with your app.
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2639
by: Arend Jan Nijenhuis | last post by:
Hi, I'm fairly new to .Net, but an expert in Microsoft Access VBA. For a large Access application, I want to create some sort of custom control (COM interop?) in VB.Net, to be used in an Access form. The control needs to put together a simple design drawing for building constructors, based on some values in the Access form. Can it be done?
1
2029
by: SortaNortth | last post by:
Is it possible to code to a VB.NET windows form button to open a Microsoft Access Form? If so, which namespace(s)/class(es) would I use in doing the coding? Are there any good reference books that talk about opening application programs from within VB.NET? (or is this either not possible, in general, or just not a good idea?) Thanks for any info Dick Marcum
2
4947
by: John | last post by:
I have an Access 2000 form that has a Hyperlink that opens an Excel 2000 worksheet located in the same network folder as the Access MDB. The Hyperlink works great. When users close the Excel File, they must choose the correct open Access form on the Windows Desktop Taskbar to return to the Access form that had the Hyperlink. Is there a way to:
4
2185
by: Sibasis Ganguly | last post by:
I want a vb code by which ,when I open the database directly that created form will open , I don't want to click on form button then opening the form. If there is any code for my problem please informe me.
4
1971
by: Shailja | last post by:
Hi, Can anyone tell me how to open an access form from VB when access database is closed? Form gets open when database is open but I want code to open access form when database is closed?
3
2902
by: buddyr | last post by:
I am scanning a barcode into first textbox on a microsoft access form. When I scan barcode - the number does not appear in textbox. When I tab to next textbox - it appears. Is there a way to have it show up in textbox right after I scan it? also can the next textbox have the focus too. Or do you have to tab? Thank you
3
3990
by: getro | last post by:
Hi Everyone, I need to open an Access 2003 form to a specific record from a custom Outlook 2003 Appointment form. The form has a command button that would pass a record id to access and open the appropriate record. I have searched through many Outlook and Access books and the web and cannot seem to find any info on this. Your help would be greatly appreciated. Serge
2
1552
by: tomisin | last post by:
Hi Everyone, Please, I am currently working on an Access Project and any assistance from this forum would be appreciated. I developed some forms in MS-Access 2000 and I am currently using them to update the database. However, I noticed that whenever I reopen the database/form, the first form that is displayed usually contain the result of the last query or record viewed. Please, how can I open an access form and have all the fields as empty....
2
6210
by: buddyr | last post by:
Hello, I saw an example of microsoft access form based on table. the form had combo box to select employee and and then labels and textboxes below. The form had a pie chart that changed to correspond to each record. I cannot create a pie chart that changes with each record and displays on the form.. Do you know how to create a pie chart on a form that changes to data on each record? thank you
0
9090
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8969
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1962
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.