Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2004, 02:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linking to backend

When I change the path to the backend, Access remembers it. So next time I open Access, it is still linked to the backend. How can I emulate this "memory" in VB6 please?

Clive Astley
__________________
Clive Astley
 
Old January 14th, 2004, 04:38 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is the back end Access or SQL Server?



Sal
 
Old January 15th, 2004, 02:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for replying Sal. Backend is Access.

Clive Astley
 
Old January 15th, 2004, 02:48 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you have a split database, delete all of your links and re-link them. This will ensure that your old path is removed and a new one is created.



Sal
 
Old January 16th, 2004, 03:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Sal. But I now think I didn't make my original request clear.

If I have a split Access database then I can change the location of the backend using Linked Table Manager. The next time Access starts it "remembers" the new backend location.

I now want to have a VB6 frontend with an mdb backend. I can set up an initial backend path. But I want some way that the end user can change the backend path and VB6 "remembers" the new location the next time it is started.

How can I do this please?

Clive Astley
 
Old April 1st, 2004, 09:27 AM
Registered User
 
Join Date: Apr 2004
Location: Bristol, n/a, United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could do what I do.
In VB6 use a locations.mdb which has [name] [location] so that a name can be selected in VB6 to link to the database. (Not a lot of help if the link is pointing to the wrong backend database)

I need to be able to change/error check to make sure the link is pointing to the correct backend database.

Andy

<b>Andy Barfoot</b>
 
Old April 1st, 2004, 01:35 PM
Authorized User
 
Join Date: Feb 2004
Location: Edmonton, Alberta, Canada.
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Conventional approaches are to use an .ini file or registry entry and retrieve the information at startup of your application. For ini file use, have a look for getprofilestring at google. Access, since 97 at least, has some built in functions for registry read/write. I can't tell you about VB6 but you shouldn't find it too difficult to find some API samples for create/read/write of registry keys for your application. Unconventional approaches include creating a textfile in a determinate location (you can retrieve several special folders such as the system folder by API call). In Access you could create and append a property to a database object (or even something like a form document object) that thereafter is persistent between application sessions.

I have the following DAO routine run to create a text property when it doesn't exist. It runs in the error handler when I attempt to set a property that doesn't exist and just creates it on the fly if it doesn't exist. I use it to store things like the last compacted date but it could be used to store any information you want to store between sessions of an Access Front End application.

Sub AddProperty(strPropertyName As String, db As Database)

Dim prp As Property

    Set prp = db.CreateProperty(strPropertyName, dbText, False)
    db.Properties.Append prp
End Sub

While this won't work in your VB application, perhaps there are other persistent properties you can create and set.

Ciao
Jürgen Welz
Edmonton AB Canada
jwelz@hotmail.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help creating this Form with a backend Class iampedro ASP.NET 2.0 Basics 0 February 10th, 2007 05:26 PM
Path to database backend Clive Astley Beginning VB 6 3 January 12th, 2007 01:29 AM
Backend Issues Aaron Edwards Access 3 August 26th, 2005 10:50 PM
Backend security simmyboy Access 3 August 22nd, 2005 02:42 AM
Backend as a constant Steven Access 1 June 29th, 2003 11:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.