473,416 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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 12246
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*******@discussions.microsoft.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 AccessApplication As New Microsoft.Office.Interop.Access.Application

If Not AccessApplication.Visible = True Then
AccessApplication.Visible = True
End If

AccessApplication.OpenCurrentDatabase("e:\My Documents\db1.mdb")
AccessApplication.DoCmd.OpenForm("MyAccessFormName ",
Microsoft.Office.Interop.Access.AcFormView.acNorma l)

'...
'...

AccessApplication.Quit()

End Sub
Paul ~~~ pc******@ameritech.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.tbCtlRow
sCrit = "some stuff for access to use"
'Startup Access Now
Dim AccessApplication As New Access.Application
'Make it visible ?should we do this later?
If Not AccessApplication.Visible = True Then
AccessApplication.Visible = True
End If
'Open app
AccessApplication.OpenCurrentDatabase(sFile)
'Call a function to start things running and pass in the user rights
that will be used to initalize everything
AccessApplication.Run("Main", sCrit.ToString)
Return FileMngr.Success

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.FileNotFoundException: File or assembly name Interop.Access, or
one of its dependencies, was not found.
File name: "Interop.Access"
at TransAct.ClientAppHelper.OpenApp()
at TransAct.frmMain.OpenClientApp() in
D:\nwis\Apps\LandMan\VS\TransAct\TransAct\frmMain. 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\LandMan\VS\TransAct\TransAct\bin\
LOG: Initial PrivatePath = NULL
Calling assembly : TransAct, Version=1.0.1887.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.6916071-06:00"
xmlns:d2p1="http://tempuri.org/dsErrorHandler.xsd">
<Exception>System.IO.FileNotFoundException: File or assembly name
Interop.Access, or one of its dependencies, was not found.
File name: "Interop.Access"
at TransAct.ClientAppHelper.OpenApp()
at TransAct.frmMain.OpenClientApp() in
D:\nwis\Apps\LandMan\VS\TransAct\TransAct\frmMain. 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\LandMan\VS\TransAct\TransAct\bin\
LOG: Initial PrivatePath = NULL
Calling assembly : TransAct, Version=1.0.1887.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*******@nospam.com
"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:05********************************@4ax.com...
On Tue, 8 Feb 2005 15:47:03 -0800, bbdobuddy
<bb*******@discussions.microsoft.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 AccessApplication As New
Microsoft.Office.Interop.Access.Application

If Not AccessApplication.Visible = True Then
AccessApplication.Visible = True
End If

AccessApplication.OpenCurrentDatabase("e:\My Documents\db1.mdb")
AccessApplication.DoCmd.OpenForm("MyAccessFormName ",
Microsoft.Office.Interop.Access.AcFormView.acNorma l)

'...
'...

AccessApplication.Quit()

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

Nov 21 '05 #4
On Wed, 2 Mar 2005 16:30:03 -0600, "moondaddy" <mo*******@nospam.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.tbCtlRow
¤ sCrit = "some stuff for access to use"
¤ 'Startup Access Now
¤ Dim AccessApplication As New Access.Application
¤ 'Make it visible ?should we do this later?
¤ If Not AccessApplication.Visible = True Then
¤ AccessApplication.Visible = True
¤ End If
¤ 'Open app
¤ AccessApplication.OpenCurrentDatabase(sFile)
¤ 'Call a function to start things running and pass in the user rights
¤ that will be used to initalize everything
¤ AccessApplication.Run("Main", sCrit.ToString)
¤ Return FileMngr.Success
¤
¤ 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.FileNotFoundException: File or assembly name Interop.Access, or
¤ one of its dependencies, was not found.
¤ File name: "Interop.Access"
¤ at TransAct.ClientAppHelper.OpenApp()
¤ at TransAct.frmMain.OpenClientApp() in
¤ D:\nwis\Apps\LandMan\VS\TransAct\TransAct\frmMain. 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\LandMan\VS\TransAct\TransAct\bin\
¤ LOG: Initial PrivatePath = NULL
¤ Calling assembly : TransAct, Version=1.0.1887.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.6916071-06:00"
¤ xmlns:d2p1="http://tempuri.org/dsErrorHandler.xsd">
¤ <Exception>System.IO.FileNotFoundException: File or assembly name
¤ Interop.Access, or one of its dependencies, was not found.
¤ File name: "Interop.Access"
¤ at TransAct.ClientAppHelper.OpenApp()
¤ at TransAct.frmMain.OpenClientApp() in
¤ D:\nwis\Apps\LandMan\VS\TransAct\TransAct\frmMain. 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\LandMan\VS\TransAct\TransAct\bin\
¤ LOG: Initial PrivatePath = NULL
¤ Calling assembly : TransAct, Version=1.0.1887.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******@ameritech.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
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...
1
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...
2
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...
4
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...
4
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
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...
3
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...
2
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...
2
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.