The code commences with a lengthy portion that I am skipping here that
populates a table in the Access front-end. (The main tables are linked from a
SQL Server db). The form in question has as its record source this table
populated from the beginning of procedure. The end of the procedure sets up
which of 2 forms will be displayed (the second of which is not the problem).
With the first form this code opens the form and calls 2 other procedures.
These 2 procedures populate some header titling information and set which
controls on the form will be visible. I have tried the code without
activating either the 2nd or 3rd procedure with no more success. In all cases
what occurs is somehow the form by the time it should be displayed supposedly
does not have a record source. Yet when I close it, go to the database window
and open it it displays exactly as it should.
I have listed the code as follows: the main code 1st (As I mentioned I left
of the beginning that populates the table that is the forms record source.)
The 2nd and the 3rd as called by the first code. The form in question is
named 'frmTestSelectionSpec" and is referred to in the code as strNextForm
THE MAIN CODE
If strAddOrEdit <> "Save" Then
For x = 0 To 2
If aryHasTestSources(x) = True Then
Debug.Print "2. aryHasTestSources(" & x & ") = " &
aryHasTestSources(x)
aryScreenSetup = Array(strFrom, lngSlctdTRID, lngTRNmbr,
aryTestSourceIDs(0), aryTestSources(0), _
aryTestMapIDs(0), aryColCount(0), aryTestSourceIDs(1),
aryTestSources(1), aryTestMapIDs(1), _
aryColCount(1), aryHasTestSources(2), strTestCatAndComp)
strSlctdTempTable = aryTempTables(x)
If x < 2 Then
blnTestingCreated = True
strNextForm = "frmTestSelectionSpec"
lngChkPt = 27
DoCmd.OpenForm strNextForm
Forms(strNextForm).RecordSource = strSlctdTempTable
Call SetMapDisplay(aryColCount(x), strSlctdTempTable)
Call SetMapHeaderInfo(aryScreenSetup, strSlctdTempTable,
strNextForm)
If strAddOrEdit = "Add" Or strAddOrEdit = "Edit" Or
strAddOrEdit = "NewByCopy" Then
Call UnlockForEdit(strNextForm, False, aryColCount(x))
ElseIf strAddOrEdit = "View" Then
Call UnlockForEdit(strNextForm, True, aryColCount(x))
End If
lngChkPt = 28
'-- Lock the map screen when a primary spec with full
phase is displayed
If lngPartialFullPhase = 2 And x = 0 Then
Call UnlockForEdit(strNextForm, True, aryColCount(x))
End If
'-- For a new test load for a primary spec in full
phase mark all tests as selected
If strAddOrEdit = "Add" Or strAddOrEdit = "NewByCopy" Then
If lngPartialFullPhase = 2 And x = 0 Then
Set rstFullPhaseSet = Forms(strNextForm).Recordset
With rstFullPhaseSet
.MoveFirst
Do Until .EOF
.Edit
!TestLegSlctd = -1
.Update
Call
Forms(strNextForm).Form.chkLeg_AfterUpdate
.MoveNext
Loop
End With
rstFullPhaseSet.Close
End If
End If
Application.Echo True
GoTo JumpToShowTests
ElseIf x = 2 Then
blnTestingCreated = True
DoCmd.OpenForm "frmTestSelectionSpecial", , , , , ,
strNextScreenSetup
Application.Echo True
End If
End If
Next x
End If
JumpToShowTests:
2ND PROCEDURE
Sub SetMapDisplay(lngMaxNmbrCols As Long, strRecordSourceToUse As String)
Dim x As Integer
Dim strFormToUse As String
Dim strSlctControl As String
strFormToUse = "frmTestSelectionSpec"
' Forms(strFormToUse).RecordSource = ""
' Debug.Print "strRecordSourceToUse = " & strRecordSourceToUse
' Forms(strFormToUse).RecordSource = strRecordSourceToUse
For x = 65 To 84
strSlctControl = "lblCol" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "chk" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtQty" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "chkDVPR" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtTestNmbrYes" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtTestNmbrNo" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtTestNameYes" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtTestNameNo" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtIsTest" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtDVPR" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "txtTest" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
strSlctControl = "box" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = True
Next x
For x = 84 To 65 + lngMaxNmbrCols Step -1
strSlctControl = "lblCol" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "chk" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtQty" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "chkDVPR" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtTestNmbrYes" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtTestNmbrNo" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtTestNameYes" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtTestNameNo" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtIsTest" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtDVPR" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "txtTest" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
strSlctControl = "box" & Chr(x)
Forms(strFormToUse).Controls(strSlctControl).Visible = False
Next x
End Sub
3RD PROCEDURE
Sub SetMapHeaderInfo(aryScreenSetupToUse, strRecordSourceToUse As String,
strNextFormToUse As String)
Dim aryScreenFactors
Dim x As Integer
strMapListPrevious = aryScreenSetupToUse(0)
lngMapListTRID = aryScreenSetupToUse(1)
lngTRNmbr = aryScreenSetupToUse(2)
lngMapListSpecID = aryScreenSetupToUse(3)
strSpecNmbr = aryScreenSetupToUse(4)
lngSpecMapID = aryScreenSetupToUse(5)
lngSpecColNmbr = aryScreenSetupToUse(6)
lngSecondarySpecID = aryScreenSetupToUse(7)
str2ndSpecNmbr = aryScreenSetupToUse(8)
lng2ndSpecMapID = aryScreenSetupToUse(9)
lng2ndSpecColNmbr = aryScreenSetupToUse(10)
blnHasSpecialTesting = aryScreenSetupToUse(11)
strCatAndComp = aryScreenSetupToUse(12)
Forms(strNextFormToUse)!txtTestRequestID = lngMapListTRID
Forms(strNextFormToUse)!txtTestRequestNmbr = lngTRNmbr
Forms(strNextFormToUse)!txtSpecID = lngMapListSpecID
Forms(strNextFormToUse)!txtSecondarySpecID = lngSecondarySpecID
Forms(strNextFormToUse)!txtHasSpecialTesting = blnHasSpecialTesting
If lngSecondarySpecID = 0 Or IsNull(lngSecondarySpecID) Then
Forms(strNextFormToUse)!cmdSecondarySpecTests.Enabled = False
ElseIf lngSecondarySpecID > 0 Then
Forms(strNextFormToUse)!cmdSecondarySpecTests.Enabled = True
End If
If blnHasSpecialTesting = False Then
Forms(strNextFormToUse)!cmdSpecialTests.Enabled = False
ElseIf blnHasSpecialTesting = True Then
Forms(strNextFormToUse)!cmdSpecialTests.Enabled = True
End If
lngNmbrColsNow = lngSpecColNmbr
If strMapListPrevious = "frmAddNewTR" Then
Forms(strNextFormToUse)!lblFormTitle.Caption = "Tests for " &
strSpecNmbr & " for New TR"
' ElseIf blnIsNewByCopy = False Then
' Forms(strNextFormToUse)!lblFormTitle.Caption = "Tests for " &
strSpecNmbr & " for New TR"
Else
Forms(strNextFormToUse)!lblFormTitle.Caption = "Tests for " &
strSpecNmbr & " for TR # " & Format(lngTRNmbr, "000000")
End If
' If blnIsEdit = True Then
' Call SetForEdit
' End If
End Sub
Thank you for your quick response. It was appreciated.