Data entry report -
03-13-2011
, 01:58 PM
Need to create a data entry report for each project to show fields
that do NOT have data. Could be by projectid which has data spread
across several tabs or tab by tab as user moves through. I am having
trouble creating an iteration from tab to tab and controls on the sub
forms on the tabs. I can produce the missing data fields for the first
form and tab but not the rest.
Think that there may be a way to marry the following two functions.
Suggestions greatly appreciated.
Also would like to add a check on each tab for displaying missing
fields prior to leaving the tab that would check each sub forms data
even if the user did not enter the cursor into a particular sub form
on a tab.
Public Function Checktab()
'On Error Resume Next
Dim ProjectTab As control, pge As Page
'Return reference to tab control.
Set ProjectTab = Me!TabCtl58
'Return reference to currently selected page.
Set pge = ProjectTab.Pages(ProjectTab.Value)
ProjectIDTemp = Me!ProjectID
If IsNull(Me!ProjectID) Or Me!ProjectID = "" Or Me!ProjectID = 0
Or Me!ProjectID = "(New)" Then
Me.TabCtl58.Pages(0).SetFocus
Exit Function
End If
If ProjectTab.Value = 0 Then
'Projects Tab
Forms!Projects.Form!TotalCosts.Form.Requery
ElseIf ProjectTab.Value = 1 Then
'Staff Tab
ElseIf ProjectTab.Value = 2 Then
'Partners Tab
ElseIf ProjectTab.Value = 3 Then
'Location / Watershed Tab
ElseIf ProjectTab.Value = 4 Then
'Biological Tab
ElseIf ProjectTab.Value = 5 Then
'Contractors Tab
ElseIf ProjectTab.Value = 6 Then
'Construction Tab
ElseIf ProjectTab.Value = 7 Then
'Performance Tab
ElseIf ProjectTab.Value = 8 Then
'Parameters Tab
ElseIf ProjectTab.Value = 9 Then
'Documents Tab
Forms!Projects.Form!Documents1.Form.Requery
ElseIf ProjectTab.Value = 10 Then
'Drawings Tab
ElseIf ProjectTab.Value = 11 Then
'Photo Tab
On Error Resume Next
Call [Form_ProjectThumbnailsC].P_InitializeG
ElseIf ProjectTab.Value = 12 Then
'Maintenance Tab
ElseIf ProjectTab.Value = 13 Then
'Assessments Tab
ElseIf ProjectTab.Value = 14 Then
'Water Supply Tab
ElseIf ProjectTab.Value = 15 Then
'Land Tenure Tab
ElseIf ProjectTab.Value = 16 Then
'Funding Tab
Else
'Error
End If
End Function
‘_________________________________________________ __________________
Function CheckDataEntry()
On Error GoTo Err_Handler
Dim C As control, xName As String, F As Form, Pg As Page
Dim ProjectTab As control, pge As Page
'Return reference to tab control.
Set ProjectTab = Forms!Projects.Form.TabCtl58
'Set MyForm = Screen.ActiveForm
For Each Pg In ProjectTab.Pages
MsgBox Pg.Name
Pg.SetFocus
'Check eack form
'For Each F In Forms
' MsgBox F.Name
'Next F
'Check each data entry control for data
'For Each C In F.Controls
For Each C In ProjectTab.Controls
'Only check data entry type controls.
Select Case C.ControlType
Case acTextBox, acComboBox ', acListBox, acOptionGroup
' If control was previously Null, record "previous
' value was blank."
If IsNull(C.OldValue) Or C.OldValue = "" Then
MsgBox C.Name & " has no data"
End If
End Select
Next C
Next Pg
'usage
TryNextC:
Exit Function
Err_Handler:
If Err.Number <> 64535 Then
MsgBox "Error #: " & Err.Number & vbCrLf & "Description: " &
Err.Description
End If
Resume TryNextC
End Function |