I am new to developing runtime applications. If the user
has runtime front end and back end (ie front end has
links to tables in back end data database), how do you
change the table design at the users location to add new
fields, etc??
Chris Mills - 25 Nov 2003 20:04 GMT
Here's one method. Naturally, whoever runs it must have design permissions on
the BE database and tables. It also involves checking version levels (invented
by oneself) to see if an upgrade is necessary, though the routine also sees if
the upgrade has been done.
(Whenever you open the FE, check the version level between FE & BE, if the BE
needs upgrading then run the routine. This would be faster than unnecessarily
running the routine)
----------
(the style shows a bit of age, not looking for prizes :-) )
----------
Public Function UpgradeTable(VerLevel As Single) As Integer
On Error GoTo Err_UpgradeTable
Dim db As Database
Dim dbs As Database
Dim td As TableDef
Dim MyField As Field
Dim i As Integer
Dim j As Integer
Dim s As String
Dim FullDBName As String
UpgradeTable = False
Set db = CurrentDb()
Set td = db.TableDefs("SomeTable") 'any linked table to find the BE
s = td.Connect
FullDBName = Right$(s, Len(s) - InStr(1, s, "="))
Set dbs = OpenDatabase(FullDBName)
'----------------------------------
'Check for extra NEWFIELD field
If VerLevel < 0.13 Then 'Whatever the version upgrade level is
Set td = dbs.TableDefs("SomeTable")
j = 0
For i = 1 To td.Fields.Count - 1
Set MyField = td.Fields(i)
If MyField.Name = "NEWFIELD" Then
j = 1
End If
Next
If j = 0 Then
Set MyField = td.CreateField("NEWFIELD", dbText)
MyField.Size = 25
td.Fields.Append MyField
End If
End If
'----------------------------------
dbs.Close
UpgradeTable = True
Exit Function
Err_UpgradeTable:
MsgBox Error$
dbs.Close
Exit Function
End Function
----------
> I am new to developing runtime applications. If the user
> has runtime front end and back end (ie front end has
> links to tables in back end data database), how do you
> change the table design at the users location to add new
> fields, etc??
MS Access Developer - 28 Nov 2003 08:16 GMT
The links in the frontend will update themselves
automatically the first time the table with the changes
is used. Beware not to delete fields that are being used
in the frontend. Doing this will cause the frontend to
have runtime errors. There is no need to relink unless
you are changing the location of the backend on the
network or the links point to a data sources other than
Access.
>-----Original Message-----
>I am new to developing runtime applications. If the user
[quoted text clipped - 3 lines]
>fields, etc??
>.