PC Review


Reply
Thread Tools Rate Thread

Loading an Access database in code

 
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
Hi everyone,

I am trying to create a vb program which, among other things, will open
a new copy of MS Access (with a custom copy of the system.mdw) and load
a database. I have been trying to utilise the
System.Diagnostics.Process.Start function, but this fails to correctly
load the required system.mdw. Does anyone have any ideas?

Thanks in advance,

Ian

 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      26th Sep 2005
Ian,

Is this what you mean?

http://www.windowsformsdatagridhelp....1-d6dda3c888c8

I hope this helps,

Cor


 
Reply With Quote
 
 
 
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
Thanks for the response Cor.

It isn't quite what I mean - I don't want to control the database from
within my VB program, I just wish to load access and then stop running
the VB program. Part of the function of this program is to provide an
intelligent database loader, and in effect, replacing the current
shortcut (which calls: "C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE" "S:\Database.mdb" /wrkgrp
"S:\system.mdw").

Thanks again,

Ian

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      26th Sep 2005
Ian,

Can you than show the code of that application.start, because that
applications start with as path the dbs should (normally) start access.

Cor


 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
Hi Cor,

I'm not sure what you mean? What I would like to acheive is basically
an application load command which calls LOAD("C:\Program
Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "S:\Database.mdb" /wrkgrp
"S:\system.mdw") (or equivalent).

Ian

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      26th Sep 2005
Ian,

You wrote this
System.Diagnostics.Process.Start

And this should in my opinion go

System.Diagnostics.Process.Start("c:\Ian.dbf")
if that dbf exist and is on C

(If you have the proper rights of course to that file, if you don't see it
in that location in explorer you wont be able to use it).

Here bellow a more complete one if you want to try that one

\\\Notepad
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.arguments = "c:\windows\win.ini"
pi.FileName = "notepad.exe"
p.startinfo = pi
p.Start()
\\\

Cor

"Ian" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi Cor,
>
> I'm not sure what you mean? What I would like to acheive is basically
> an application load command which calls LOAD("C:\Program
> Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "S:\Database.mdb" /wrkgrp
> "S:\system.mdw") (or equivalent).
>
> Ian
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
Hi Cor,

I think that I am now starting to get there. I have looked at your code
and am happy with how it is working. I have also modified it to
correctly load the database:
\\\Database
Dim p As New Process
Dim pi As New ProcessStartInfo
With pi
.FileName = "C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE "
.Arguments = "C:\Database.mdb /wrkgrp C:\system.mdw /user
USER /pwd PWD"
End With
p.StartInfo = pi
p.Start()
\\\
This works perfectly. However, once I had tested this and was happy it
was working, I then changed the link to reflect the true location of
the database on a network share not my own PC - at that point, Access
refused to load the database. It claims that I am trying to open Access
with an incorrect startup option.

Thanks again for the assistance.

Ian

 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
Hi Cor

I have been playing around and now found out that the problem now is
spaces in the folder names. Is there anything that I can do about this?

Thanks,

Ian

 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      26th Sep 2005
I have now sorted the problem by cunning use of the old MSDOS format
for dealing with long filenames. Thanks for all your help!

Ian

 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      26th Sep 2005
Cor, I was looking at your example in the link you gave and didn't understand
this part of the table creation statement:

"CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId))

What does this do (don't understand what pk_AutoID is?
--
Dennis in Houston


"Cor Ligthert [MVP]" wrote:

> Ian,
>
> Is this what you mean?
>
> http://www.windowsformsdatagridhelp....1-d6dda3c888c8
>
> I hope this helps,
>
> Cor
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading native code dll using vc++ .net 2.0 managed code antarikshv Microsoft Dot NET Framework 5 25th Apr 2009 10:13 AM
Using access to access an access database and an SQL database at t Henry Microsoft Access 7 26th Aug 2008 03:23 PM
HELP: VBA Code to extract data from an SQL Server database and put it into Access Database Clinton M James Microsoft Excel Programming 1 8th Oct 2007 12:44 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM
Updating database from Typed Dataset without loading entire database Jeremy Summers Microsoft ADO .NET 2 10th Sep 2003 06:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 AM.