Delete the Relationships in a back end DB (1 Viewer)

MarionD

Registered User.
Local time
Today, 02:18
Joined
Oct 10, 2000
Messages
421
BACKGROUND:

I have a DB Front/Back End. I have made a couple of changes to the Front End but, as this is a "Version" Update - it means that there are a couple of changes to the Data Back End as well. I have written the code to
1. Delete the Links to the Tables in to the Back end (only the ones I need to change)
2. Import the Tables to be changed into the front end (mainly just a field added)
3. Change the Tables as local tables in the front end
3. Export the updated Tables back to the Back End
4. Delete the Tables in the Front End
5. Relink them.

The user installs the new Front end and click on a button - "Update" which checks the Version Number and runs the update code.

PROBLEM:

If the Tables in the Back end are part of a 1-N relationship I can't export them back to the Back end without first deleting the relationship in the back end DB

QUESTION:

Is there any way to delete the relationship in the Back end DB from code run in the Front end?
 

Tim K.

Registered User.
Local time
Today, 02:18
Joined
Aug 1, 2002
Messages
242
If the new field to be added is not the PK or FK, why can add the new field right in the back end. Tell me more about the field, is it Text type or what?

Check this code out.

Code:
Private Sub AddField()
Dim dbs As Database, strDBFile As String
strDBFile = InputBox("Where is the back end db?")
If Len(strDBFile) > 0 Then
   Set dbs = OpenDatabase(strDBFile)
    ' Add the Generated field to the tblOrder table
    ' and make it a YesNo data type.
    dbs.Execute "ALTER TABLE tblOrder " _
       & "ADD COLUMN Generated YESNO;"
    dbs.Close
    Set dbs = Nothing
End If
 

MarionD

Registered User.
Local time
Today, 02:18
Joined
Oct 10, 2000
Messages
421
Hi Tim,

Thank you so much for the reply and the snippet of code. It is exactly what I needed - I really didn't know that you could open another DB from within the front - end DB. I have written long reams of code that were totally unnecessary! Anyway now I know - Thanks again - I don't have to import /export the tables - Easy when you know how!

Marion
 

Users who are viewing this thread

Top Bottom