As you continue to examine the sections of the ap_AppInit() function, now look at section 3, which opens and tests the connection for one of the tables located in the back end, with the connection being a link in the front end.
'-- Section 3: Open the table containing the list of linked tables Set dynSharedTables = dbLocal.OpenRecordset("tblSharedTables", _ dbOpenDynaset) On Error Resume Next dynSharedTables.MoveLast Set dynTestTable = dbLocal.OpenRecordset(dynSharedTables!TableName, _ dbOpenDynaset) intCurrError = Err.Number strCurrError = Err.Description Do Until intCurrError = 0 On Error GoTo Error_ap_App_Init Select Case intCurrError Case apErrFileNotFound, apErrTableNotFound, _ apErrPathNotValid, apErrDeviceNotAvlble
The code in section 3 performs these actions:
Note
tblSharedTables contains two Text-type fields: TableName and ExportFileName. Figure 26.8 shows what the table looks like in datasheet mode in the World Wide Video Application.
The code sets error handling to ignore errors and just moves to the next line by using the On Error Resume Next statement.
The code begins a loop that performs another test (at the bottom), as in step 3. Inside this loop are the corrections for the various errors. When one error is solved—for example, a moved back end—the loop tests again and sends the code execution through the error list again.
The code turns on error handling again and examines the possible errors that occurred. Constants are used to represent the errors that you want to look for.
The following table shows the error constants looked for in this section. All these errors can be handled by relinking the tables.
3.129.218.45