S
Sierras
I?m having a little trouble with re-connecting the front end of a database
with the back end using code in a hidden start-up form.
I got this code from one the users of this forum (Thanks Mike) and then
modified it to suit my database. But I can?t get it work properly and
hope someone can find my mistake.
If the BE is in the same folder as the FE, then the reconnect function
from PETER VUKOVIC is called (http://allenbrowne.com/ser-13.html). This
function seems to work, but only on the second opening of the database.
That is, on the first opening after the BE is moved to a different folder,
the function works, but the start-up form pops up anyway. If I just close
the program and start again, the tables are all linked.
Here is my start-up form which is supposed to be hidden if the BE and FE
are already linked or in the same folder. Is there anything obviously
wrong with this?
Private Sub Form_Open(Cancel As Integer)
' try to open a recordset with this table
If Not InitOk("tblEmployees") Then
' did not work, so maybe data file is in this folder
If Not (Reconnect = True) Then
' did not work, so continue opening this form
End If
Else
' links OK now, so open switchboard
DoCmd.OpenForm "frmSwitchBoard"
' and cancel opening this form
Cancel = True
End If
' links are already OK, so open switchboard
End Sub
with the back end using code in a hidden start-up form.
I got this code from one the users of this forum (Thanks Mike) and then
modified it to suit my database. But I can?t get it work properly and
hope someone can find my mistake.
If the BE is in the same folder as the FE, then the reconnect function
from PETER VUKOVIC is called (http://allenbrowne.com/ser-13.html). This
function seems to work, but only on the second opening of the database.
That is, on the first opening after the BE is moved to a different folder,
the function works, but the start-up form pops up anyway. If I just close
the program and start again, the tables are all linked.
Here is my start-up form which is supposed to be hidden if the BE and FE
are already linked or in the same folder. Is there anything obviously
wrong with this?
Private Sub Form_Open(Cancel As Integer)
' try to open a recordset with this table
If Not InitOk("tblEmployees") Then
' did not work, so maybe data file is in this folder
If Not (Reconnect = True) Then
' did not work, so continue opening this form
End If
Else
' links OK now, so open switchboard
DoCmd.OpenForm "frmSwitchBoard"
' and cancel opening this form
Cancel = True
End If
' links are already OK, so open switchboard
End Sub