THEO TODMAN’S WEBSITE CODE PAGES



This Page provides a jumping-off point for the VBA Code that generates my Website.

Table of Code Documentation Location 31 (11 items)

Form_OpenCount_BookPapersFunctor_19Functor_21
Functor_22Functor_23Number_FormatAeon_Authors_Add
BooksToNotes_PrelimsCheckerJacks_Non_Prime.

To access information, click on one of the links in the table above.

Go to top of page




Source Code of: Aeon_Authors_Add
Procedure Type: Public Sub
Module: New Code
Lines of Code: 108
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Sub Aeon_Authors_Add()
0002Dim rs As Recordset
0003Dim rsAuthors As Recordset
0004Dim rsAuthor_Parameter As Recordset
0005Dim strQuery As String
0006Dim strAuthor As String
0007Dim strAuthor_Saved As String
0008Dim Author As String
0009Dim Author_Reformat As String
0010Dim i As Integer
0011Dim j As Integer
0012Dim k As Integer
0013Dim x As Integer
0014Dim strMessage As String
0015Dim Output_Authors As Boolean
0016Dim Output_Old_Authors As Boolean
0017 strMessage = "Get ready to output Authors pages? Usually wait to output until we've output the Aeon note with 'Refresh Links', but this will maintain the Author_Parameter table."
0018If MsgBox(strMessage, vbYesNo + vbDefaultButton1) = vbYes Then
0019 Output_Authors = True
0020 strMessage = "Add all relevant Authors pages, including newly-loaded ones, to Author_Parameter table?"
0021 If MsgBox(strMessage, vbYesNo + vbDefaultButton1) = vbYes Then
0022 Output_Old_Authors = True
0023 Else
0024 Output_Old_Authors = False
0025 End If
0026Else
0027 Output_Authors = False
0028 Output_Old_Authors = False
0029End If
0030strAuthor_Saved = ""
0031' Clear & ready Author_Parameter Table
0032 strQuery = "DELETE * FROM Author_Parameter;"
0033DoCmd.RunSQL (strQuery)
0034 strQuery = "SELECT * FROM Author_Parameter;"
0035Set rsAuthor_Parameter = CurrentDb.OpenRecordset(strQuery)
0036' Select Aeon_Files rows with Authors encoded
0037 strQuery = "SELECT Aeon_Files.Author_Names FROM Aeon_Files WHERE (((Aeon_Files.Author_Names) Like ""*+A*"")) ORDER BY Aeon_Files.Author_Names;"
0038Set rs = CurrentDb.OpenRecordset(strQuery)
0039rs.MoveFirst
0040Do Until rs.EOF
0041 strAuthor = rs.Fields(0)
0042 If strAuthor <> strAuthor_Saved Then
0043 'Find the authors
0044 i = 1
0045 j = 1
0046 Do Until j = 0
0047 j = InStr(i, strAuthor, "A+")
0048 If j > 0 Then
0049 Author = Mid(strAuthor, i + 2, j - i - 2)
0050 'Check if on Author's Table
0051 strQuery = "SELECT Authors.Author_Name, Authors.Author_Name_Display FROM Authors WHERE (((Authors.Author_Name)=""" & Author & """));"
0052 Set rsAuthors = CurrentDb.OpenRecordset(strQuery)
0053 If rsAuthors.EOF Then
0054 Debug.Print Author
0055 Author_Reformat = Author
0056 x = InStr(Author_Reformat, "(")
0057 If x > 0 Then
0058 k = InStr(x, Author_Reformat, ")")
0059 If k > 0 Then
0060 Author_Reformat = Mid(Author_Reformat, x + 1, k - x - 1) & " " & Trim(Left(Author_Reformat, x - 1))
0061 End If
0062 End If
0063 'Load to Author's table
0064 rsAuthors.AddNew
0065 rsAuthors.Fields(0) = Author
0066 rsAuthors.Fields(1) = Author_Reformat
0067 rsAuthors.Update
0068 Set rsAuthors = Nothing
0069 'Add to Author_Parameter Table, ready for output of the Author pages
0070 rsAuthor_Parameter.AddNew
0071 rsAuthor_Parameter.Fields(0) = Author
0072 rsAuthor_Parameter.Update
0073 Else
0074 If Output_Old_Authors = True Then
0075 'Add to Author_Parameter Table, ready for output of the Author pages (existing authors need to have their pages updated)
0076 rsAuthor_Parameter.AddNew
0077 rsAuthor_Parameter.Fields(0) = Author
0078 On Error Resume Next
0079 rsAuthor_Parameter.Update
0080 End If
0081 End If
0082 i = j
0083 i = InStr(i, strAuthor, "+A")
0084 If i = 0 Then
0085 j = 0
0086 End If
0087 End If
0088 Loop
0089 End If
0090 strAuthor_Saved = strAuthor
0091 rs.MoveNext
0092Loop
0093If Output_Authors = True Then
0094 strMessage = "Actually output the Authors pages? Usually wait until we've output the Aeon note with 'Refresh Links'."
0095 If MsgBox(strMessage, vbYesNo + vbDefaultButton2) = vbYes Then
0096 'Output the Author pages
0097 strDataQuery = "Authors_List_Selected_Authors"
0098 strControlTable = "Authors"
0099 strOutputFileShort = "Author"
0100 strOutputFolder = "C:\Theo's Files\Websites\Theo's Website\Authors\"
0101 strOutputFile = ""
0102 CreateAuthorsWebPages ("Regen")
0103 End If
0104End If
0105OK = MsgBox("Authors added OK at " & Now(), vbOKOnly)
0106Set rs = Nothing
0107Set rsAuthor_Parameter = Nothing
0108End Sub

Procedures Calling This Procedure (Aeon_Authors_Add) Procedures Called By This Procedure (Aeon_Authors_Add) Tables / Queries / Fragments Directly Used By This Procedure (Aeon_Authors_Add) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: BooksToNotes_Prelims
Procedure Type: Public Sub
Module: Testing
Lines of Code: 10

Line-No. / Ref.Code Line
0001Public Sub BooksToNotes_Prelims()
0002Dim strQuery As String
0003 strQuery = "DELETE * FROM Cross_Reference_Prelims;"
0004DoCmd.RunSQL (strQuery)
0005 strQuery = "BooksToNotes_Prelims_GEN"
0006DoCmd.OpenQuery (strQuery)
0007'Delete rows associated with Note 874 (Auto-Xref Test Note)
0008 strQuery = "DELETE * FROM Cross_Reference_Prelims WHERE Calling_ID = 874 AND Calling_Type = ""N"";"
0009DoCmd.RunSQL (strQuery)
0010End Sub

Procedures Calling This Procedure (BooksToNotes_Prelims) Tables / Queries / Fragments Directly Used By This Procedure (BooksToNotes_Prelims) Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Checker
Procedure Type: Public Sub
Module: Testing
Lines of Code: 16

Line-No. / Ref.Code Line
0001Public Sub Checker()
0002Dim rs As Recordset
0003Dim i As Integer
0004Dim ifields As Integer
0005'Set rs = CurrentDb.OpenRecordset("TRANSFORM Sum([Year_Crosstab].[Hours ]) AS Hours SELECT Average_Plans.Project, Average_Plans.[Average This Qtr Plan] AS [Planned Weekly Hours], 0 AS [Planned QTD %age], Sum(0) AS [QTD Actual %], Round([Average YTD Plan],2) AS [Planned YTD %age], Sum(0) AS [YTD Actual %], Sum(0) AS [QTD Actual Hours], Sum(Year_Crosstab.Hours) AS [YTD Actual Hours] FROM Average_Plans LEFT JOIN Year_Crosstab ON Average_Plans.Project = Year_Crosstab.Group WHERE ((((Year_Crosstab.Period) >= ""2019-10"" And (Year_Crosstab.Period) <= ""2020-09"") Or (Year_Crosstab.Period) Is Null)) GROUP BY Average_Plans.Project, Average_Plans.[Average This Qtr Plan], Round([Average YTD Plan],2) ORDER BY Average_Plans.Project PIVOT Year_Crosstab.Period;")
0006 Set rs = CurrentDb.OpenRecordset("SELECT * FROM Project_Plans;")
0007rs.MoveFirst
0008ifields = rs.Fields.Count
0009Do Until rs.EOF
0010 For i = 0 To ifields - 1
0011 Debug.Print rs.Fields(i)
0012 Stop
0013 Next i
0014 rs.MoveNext
0015Loop
0016End Sub

Tables / Queries / Fragments Directly Used By This Procedure (Checker) Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Count_BookPapers
Procedure Type: Public Function
Module: New Code
Lines of Code: 13

Line-No. / Ref.Code Line
0001Public Function Count_BookPapers(strDataQuery_Saved, Author, Medium)
0002Dim rs As Recordset
0003Dim strQuery As String
0004strQuery = "SELECT Count(" & strDataQuery_Saved & ".Title) AS CountOfTitle FROM " & strDataQuery_Saved & " GROUP BY " & strDataQuery_Saved & ".Author_Name, " & strDataQuery_Saved & ".Medium HAVING (((" & strDataQuery_Saved & ".Author_Name)=""" & Author & """) AND ((" & strDataQuery_Saved & ".Medium)=""" & Medium & """));"
0005Set rs = CurrentDb.OpenRecordset(strQuery)
0006If rs.EOF Then
0007 Count_BookPapers = 0
0008Else
0009 rs.MoveLast
0010 Count_BookPapers = rs.Fields(0)
0011End If
0012Set rs = Nothing
0013End Function

Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Form_Open
Procedure Type: Private Sub
Module: Form_MainForm
Lines of Code: 13

Line-No. / Ref.Code Line
0001Private Sub Form_Open(Cancel As Integer)
0002Dim rsTableToRead As Recordset
0003 OK = Check_Database_Size()
0004Debug.Print Now() & " - Main Database size = " & Check_Database_Size & "Mb"
0005 Set rsTableToRead = CurrentDb.OpenRecordset("SELECT Archive_Reading_Lists, Archive_Printable_Versions, Document_Tables_Full, Document_Queries_Full FROM System_Parameters;")
0006rsTableToRead.MoveFirst
0007Archive_Reading_Lists = rsTableToRead.Fields(0).Value
0008Archive_Printable_Versions = rsTableToRead.Fields(1).Value
0009Document_Tables_Full = rsTableToRead.Fields(2).Value
0010Document_Queries_Full = rsTableToRead.Fields(3).Value
0011Full_Regen = False
0012Set rsTableToRead = Nothing
0013End Sub

Procedures Called By This Procedure (Form_Open) Tables / Queries / Fragments Directly Used By This Procedure (Form_Open) Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_19
Procedure Type: Public Function
Module: Functors
Lines of Code: 42
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_19(Note_ID, Note_Title, Note_Text)
0002'Add jump table and record counts for Aeon Note 1292
0003Dim rs As Recordset
0004Dim strQuery As String
0005Dim Papers_Read As String
0006Dim Papers_UnReadTotal As String
0007Dim Papers_UnRead(10) As Integer
0008Dim Note_Text_Local As String
0009Dim i As Integer
0010Note_Text_Local = Note_Text
0011 strQuery = "SELECT Aeon_Files.[Read?], Count(Aeon_Files.WebRef_ID) AS CountOfWebRef_ID FROM Aeon_Files WHERE (((Aeon_Files.Aeon_Note_ID) = 1292) And ((Aeon_Files.[Exclude?]) = False)) GROUP BY Aeon_Files.[Read?];"
0012Set rs = CurrentDb.OpenRecordset(strQuery)
0013If Not rs.EOF Then
0014 rs.MoveFirst
0015 Papers_Read = rs.Fields(1)
0016 OK = Number_Format(Papers_Read)
0017 rs.MoveLast
0018 Papers_UnReadTotal = rs.Fields(1)
0019 OK = Number_Format(Papers_UnReadTotal)
0020End If
0021 strQuery = "SELECT Aeon_Files.Priority, Count(Aeon_Files.WebRef_ID) AS CountOfWebRef_ID FROM Aeon_Files WHERE (((Aeon_Files.Aeon_Note_ID) = 1292) And ((Aeon_Files.[Read?]) = False) AND ((Aeon_Files.[Exclude?])=False)) GROUP BY Aeon_Files.Priority ORDER BY Aeon_Files.Priority;"
0022Set rs = CurrentDb.OpenRecordset(strQuery)
0023If Not rs.EOF Then
0024 rs.MoveFirst
0025 Do Until rs.EOF
0026 Papers_UnRead(rs.Fields(0)) = rs.Fields(1)
0027 rs.MoveNext
0028 Loop
0029End If
0030Note_Text_Local = "<br><CENTER><TABLE class = ""ReadingList"" WIDTH=1200><TR>"
0031Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Intro""><B>Introduction</a></B></TD>"
0032Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Read""><B>Papers Read</a>: </B>" & Papers_Read & "</TD>"
0033Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <B>Papers Unread: " & Papers_UnReadTotal & "</B> &rarr; </TD>"
0034For i = 0 To 10
0035 If Papers_UnRead(i) > 0 Then
0036 Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Pri_" & i & """><B>Pri " & i & "</B></a>: " & Papers_UnRead(i) & "</TD>"
0037 End If
0038Next i
0039Note_Text_Local = Note_Text_Local & "</TR></TABLE></CENTER><a name=""Off-Page_Link_Project_Note_1292_Intro""></a>"
0040Note_Text = Note_Text_Local
0041Functor_19 = "Yes"
0042End Function

Procedures Calling This Procedure (Functor_19) Procedures Called By This Procedure (Functor_19) Tables / Queries / Fragments Directly Used By This Procedure (Functor_19) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_21
Procedure Type: Public Function
Module: Functors
Lines of Code: 502
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_21(strParameter, strTable, Optional strParameter2)
0002'This function formats a web-table from a Cross-tab query
0003Dim rs As Recordset
0004Dim rs_Temp As Recordset
0005Dim i As Integer
0006Dim j As Long
0007Dim m As Integer
0008Dim n As Integer
0009Dim k(100)
0010Dim iRows As Integer
0011Dim iCols As Integer
0012Dim strTable_Local As String
0013Dim strElement As String
0014Dim strCell As String
0015Dim strCell_1_Saved As String
0016Dim strCell_4_Saved As String
0017Dim strQuery As String
0018Dim strHeader As String
0019Dim iTotal_Col As Integer
0020Dim strParameter2_Local As String
0021Dim Col_Width As Single
0022Dim strWork As String
0023If IsMissing(strParameter2) Then
0024 strParameter2_Local = ""
0025Else
0026 strParameter2_Local = strParameter2
0027End If
0028Select Case strParameter
0029 Case 1
0030 strQuery = "Cross_Reference_By_Type"
0031 iTotal_Col = 0
0032 Case 2
0033 strQuery = "Cross_Reference_Changes_By_Type"
0034 iTotal_Col = 0
0035 Case 3
0036 strQuery = "Oboe_Practice_Hours_List"
0037 iTotal_Col = 0
0038 Case 4
0039 strQuery = "Auto_Ref_Notes_Stats_Summary"
0040 iTotal_Col = 4
0041 Case 5
0042 iTotal_Col = 5
0043 strQuery = "Auto_Ref_Notes_Stats_Detailed"
0044 Case 6
0045 iTotal_Col = 6 'Dummy
0046 strQuery = "Functor_Calls"
0047 Case 7
0048 Find_Functors
0049 iTotal_Col = 6 'Dummy
0050 strQuery = "Functors_FbyN"
0051 Case 8
0052 Find_Functors
0053 iTotal_Col = 6 'Dummy
0054 strQuery = "Functors_NbyF"
0055 Case 9
0056 strQuery = "Auto_Ref_Notes_Stats_Grand_Summary"
0057 iTotal_Col = 5
0058 Case 10
0059 strQuery = "Auto_Ref_Notes_Stats_Grandest_Summary"
0060 iTotal_Col = 4
0061 Case 11
0062 'Ready some stats!
0063 strQuery = "DELETE * FROM Temp_Lang_Date_Last_Study;"
0064 DoCmd.RunSQL (strQuery)
0065 strQuery = "Temp_Lang_Date_Last_Study_GEN"
0066 DoCmd.OpenQuery (strQuery)
0067 strQuery = "Language_Location_Primer_Date_Time_Updt"
0068 DoCmd.OpenQuery (strQuery)
0069 strQuery = "Language_Animadversions_List"
0070 iTotal_Col = 6
0071 Case 12
0072 strQuery = "Language_Animadversions_XTab"
0073 iTotal_Col = 50
0074 Case 13
0075 strQuery = "Language_Animadversions_XTab_Pri2"
0076 iTotal_Col = 50
0077 Case 14
0078 strQuery = "PID_Notes_Used_By_Thesis_Chapter_Xtab"
0079 iTotal_Col = 12
0080 Case 15
0081 strQuery = "IdentityPapersRead_Unreferenced"
0082 DoCmd.OpenQuery ("IdentityPapersRead_Unreferenced_Gen")
0083 iTotal_Col = 50
0084 Case 16
0085 strQuery = "PID_Notes_Used_By_Thesis_Chapter_List_Xtab"
0086 iTotal_Col = 12
0087 Case 17
0088 strQuery = "Works_Missing_By_Thesis_Chapter"
0089 iTotal_Col = 20
0090 Case 18
0091 strQuery = "IdentityBooks_Unreferenced"
0092 DoCmd.OpenQuery ("IdentityBooks_Unreferenced_Gen")
0093 iTotal_Col = 50
0094 Case 19
0095 strQuery = "PID_Notes_RL_Category_Xtab"
0096 Case 20
0097 Select Case strParameter2_Local
0098 Case 1
0099 strQuery = "Ling_Database_Summary_XTab_Vocabulary_Latin"
0100 Case 2
0101 strQuery = "Ling_Database_Summary_XTab_Vocabulary_NonLatin"
0102 Case 3
0103 strQuery = "Ling_Database_Summary_XTab_Dialogue_Latin"
0104 Case 4
0105 strQuery = "Ling_Database_Summary_XTab_Dialogue_NonLatin"
0106 End Select
0107 iTotal_Col = 50
0108 Case 21
0109 Select Case strParameter2_Local
0110 Case 1
0111 strQuery = "Ling_Language_Vocab_List_All"
0112 Case 2
0113 strQuery = "Ling_Language_Vocab_Phrase_List_All"
0114 Case 3
0115 strQuery = "Ling_Language_Dialogue_List_All"
0116 Case 4
0117 strQuery = "Ling_Language_Vocab_List_All_LessonSeq"
0118 Case 5
0119 strQuery = "Ling_Language_Vocab_Phrase_List_All_LessonSeq"
0120 End Select
0121 iTotal_Col = 50
0122 Case 22
0123 Select Case strParameter2_Local
0124 Case 1
0125 strQuery = "Ling_Language_Vocab_List_Latin"
0126 Case 2
0127 strQuery = "Ling_Language_Vocab_List_NonLatin"
0128 Case 3
0129 strQuery = "Ling_Language_Dialogue_List_Latin"
0130 Case 4
0131 strQuery = "Ling_Language_Dialogue_List_NonLatin"
0132 End Select
0133 iTotal_Col = 50
0134 Case 23
0135 strQuery = "DELETE * FROM Books_To_Regen;"
0136 DoCmd.RunSQL (strQuery)
0137 DoCmd.OpenQuery ("PID_Books_To_Regen")
0138 strQuery = "PID_Papers_Filed_Not_Referenced"
0139 iTotal_Col = 50
0140 Case 24
0141 strQuery = "PID_Papers_Referenced_Undated"
0142 iTotal_Col = 50
0143 Case 25
0144 strQuery = "PID_Papers_Referenced_No_Abstract"
0145 iTotal_Col = 50
0146 Case 26
0147 strQuery = "Large_Page_List"
0148 iTotal_Col = 50
0149 Case 27
0150 strQuery = "PDF_Missing_List"
0151 iTotal_Col = 50
0152 Case 28
0153 strQuery = "Duplicate_Papers"
0154 iTotal_Col = 50
0155 Case 29
0156 strQuery = "Missing_Webref_DisplayText_List"
0157 iTotal_Col = 50
0158 Case 30
0159 strQuery = "PID_Missing_Online_Papers_List"
0160 iTotal_Col = 50
0161 Case 31
0162 strQuery = "Bible_Reading_Progress"
0163 iTotal_Col = 50
0164 Case 32
0165 strQuery = "Missing_Webref_DisplayText_List_Books"
0166 iTotal_Col = 50
0167 Case 33
0168 strQuery = "PID_Missing_Online_Papers_List_Summary"
0169 iTotal_Col = 5
0170 Case 34
0171 strQuery = "Papers_Inconsistently_Electronic"
0172 iTotal_Col = 50
0173 Case Else
0174 Exit Function
0175End Select
0176strTable_Local = ""
0177j = 0
0178For i = 1 To 100
0179 k(i) = 0
0180Next i
0181Set rs = CurrentDb.OpenRecordset(strQuery)
0182If rs.EOF Then
0183 Debug.Print Now(); "- Functor_21, Option " & strParameter & " - Query: """ & strQuery; """ : No table to print."
0184 Functor_21 = "Yes"
0185 strTable = "|##||.|No items to display.|##|"
0186 Exit Function
0187Else
0188 rs.MoveLast
0189 iRows = rs.RecordCount
0190 iCols = rs.Fields.Count
0191 If iTotal_Col = 0 Then
0192 iTotal_Col = iCols
0193 End If
0194 rs.MoveFirst
0195End If
0196'Set up Table Header
0197Select Case strParameter
0198 Case 3, 15, 17, 18, 23, 24, 25, 28, 29, 30, 32
0199 strElement = "<table width=1500 class = ""ReadingList"">"
0200 Case 7, 8, 26, 27, 31, 34
0201 strElement = "<table width=1000 class = ""ReadingList"">"
0202 Case 11, 22
0203 strElement = "<table width=1200 class = ""ReadingList"">"
0204 Case 12, 13, 20
0205 strElement = "<table width=1200 class = ""Bridge"">"
0206 Case 21
0207 strElement = "<table width=1600 class = ""Bridge"">"
0208 Case Else
0209 strElement = "<table width=900 class = ""Bridge"">"
0210End Select
0211strTable_Local = strTable_Local & strElement
0212'Set up Table Headings
0213strElement = "<tr>"
0214For i = 1 To iCols
0215 strCell = rs.Fields(i - 1).Name
0216 Select Case strParameter
0217 Case 3
0218 If i = 1 Then
0219 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0220 Else
0221 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0222 End If
0223 Case 7
0224 If i = 1 Or i = 5 Then
0225 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0226 Else
0227 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0228 End If
0229 Case 8
0230 If i = 1 Or i = 2 Then
0231 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0232 Else
0233 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0234 End If
0235 Case 11
0236 If i = 4 Then
0237 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0238 Else
0239 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0240 End If
0241 Case 15, 17, 18, 23, 24, 25, 27, 28, 29, 30, 32, 34
0242 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0243 Case 20
0244 Col_Width = Round(100 / iCols, 1)
0245 strElement = strElement & "<th width = """ & Col_Width & "%"" align = ""Center"">" & strCell & "</th>"
0246 Case 21
0247 Select Case strParameter2
0248 Case 1, 4
0249 If i > 2 Then
0250 strCell = Mid(strCell, 4)
0251 End If
0252 Case 2, 5
0253 If i > 3 Then
0254 strCell = Mid(strCell, 4)
0255 End If
0256 Case 3
0257 If i > 5 Then
0258 strCell = Mid(strCell, 4)
0259 End If
0260 End Select
0261 strElement = strElement & "<th>" & strCell & "</th>"
0262 Case 22
0263 If i = 2 Or i = 3 Then
0264 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0265 Else
0266 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0267 End If
0268 Case 26
0269 strElement = strElement & "<th class = ""BridgeCenter"">" & strCell & "</th>"
0270 Case 31
0271 strElement = strElement & "<th class = ""BridgeLeft"">" & strCell & "</th>"
0272 Case Else
0273 strElement = strElement & "<th>" & strCell & "</th>"
0274 End Select
0275 If i = iTotal_Col And strParameter <> 3 Then
0276 strElement = strElement & "<th>TOTAL</th>"
0277 End If
0278Next i
0279strElement = strElement & "</tr>"
0280strHeader = strElement & Chr$(10)
0281If strParameter = 30 Or strParameter = 30 Then 'Err .... ********************
0282 strElement = ""
0283End If
0284strTable_Local = strTable_Local & strElement & Chr$(10)
0285'Set up Table Rows
0286strCell_1_Saved = ""
0287strCell_4_Saved = ""
0288strElement = ""
0289Do Until rs.EOF
0290 If strParameter = 11 Or strParameter = 22 Or (strParameter = 21 And (Val(strParameter2_Local) <> 3)) Then
0291 If (strCell_1_Saved <> rs.Fields(0)) And (strElement <> "") Then
0292 'Insert a blank row
0293 strElement = strElement & "<tr>"
0294 For i = 1 To iCols
0295 strElement = strElement & "<td>&nbsp;</td>"
0296 Next i
0297 strElement = strElement & "</tr>"
0298 'Insert the header row
0299 strElement = strElement & strHeader
0300 End If
0301 End If
0302 'strElement = strElement & "<tr>"
0303 j = 0
0304 For i = 1 To iCols
0305 Select Case i
0306 Case 1
0307 strWork = "<tr>"
0308 strCell = rs.Fields(0) & ""
0309 If strParameter = 7 Or strParameter = 8 Or strParameter = 11 Or strParameter = 22 Or strParameter = 24 Or strParameter = 30 Or (strParameter = 21 And (Val(strParameter2_Local) <> 3)) Then
0310 If (strCell_1_Saved = strCell) And strCell & "" <> "" Then
0311 strCell = "&uarr;&uarr;&uarr;"
0312 Else
0313 strCell_1_Saved = strCell
0314 If strParameter = 11 Or strParameter = 22 Then
0315 strCell = "+R" & strCell & IIf(strParameter = 22 And Val(strParameter2_Local) > 2, "Dialogue", "") & "R+" & "<b>" & strCell & "</b>"
0316 Else
0317 If strParameter = 30 Then
0318 strWork = Mid(strCell, 2, InStr(strCell, "]") - 2)
0319 strWork = "PDFs_" & Replace(strWork, " ", "")
0320 strWork = Left(strWork, 20)
0321 strWork = "</table><br><br>+R" & strWork & "R+<table width=1500 class = ""ReadingList"">" & strHeader & "<tr>"
0322 End If
0323 End If
0324 End If
0325 If (strParameter = 11 And rs.Fields(1) <> 0) Or strParameter = 22 Then
0326 strCell = "+R" & rs.Fields(1) & IIf(strParameter = 22 And Val(strParameter2_Local) > 2, "Dialogue", "") & "R+ " & strCell
0327 End If
0328 strElement = strElement & strWork & "<td class = ""BridgeLeft"">" & strCell & "</td>"
0329 Else
0330 strElement = strElement & strWork
0331 If strParameter = 3 Or strParameter = 26 Or strParameter = 27 Or strParameter = 28 Or strParameter = 29 Or strParameter = 32 Or strParameter = 34 Then
0332 If strParameter = 26 Then
0333 strCell = "..\..\" & Mid(strCell, Len("C:\Theo's Files\Websites\Theo's Website\") + 1)
0334 strCell = "<a href=""" & strCell & """>" & strCell & "</a>"
0335 strElement = strElement & "<td class = ""BridgeRight"">" & strCell & "</td>"
0336 Else
0337 strElement = strElement & "<td class = ""BridgeLeft"">" & strCell & "</td>"
0338 End If
0339 Else
0340 If strParameter = 15 Or strParameter = 17 Or strParameter = 18 Or strParameter = 23 Or strParameter = 24 Or strParameter = 25 Or strParameter = 30 Or strParameter = 31 Then
0341 strElement = strElement & "<td class = ""BridgeLeft"">" & strCell & "</td>"
0342 Else
0343 strElement = strElement & "<td>" & strCell & "</td>"
0344 End If
0345 End If
0346 End If
0347 Case Else
0348 strCell = rs.Fields(i - 1) & ""
0349 If strCell = "" Then
0350 strCell = "&nbsp;"
0351 Else
0352 If i <= iTotal_Col Then
0353 j = j + Val(strCell)
0354 End If
0355 k(i) = k(i) + Val(strCell)
0356 If strParameter <> 3 And strParameter <> 26 And strParameter <> 28 And strParameter <> 29 And strParameter <> 32 Then
0357 OK = Number_Format(strCell)
0358 End If
0359 End If
0360 If (i = 5 And strParameter = 7) Or (i = 2 And strParameter = 15) Or (i = 2 And strParameter = 17) Or (i = 2 And strParameter = 18) Then
0361 If strCell_4_Saved = strCell Then
0362 strCell = "&uarr;&uarr;&uarr;"
0363 Else
0364 strCell_4_Saved = strCell
0365 End If
0366 End If
0367 If i = 3 And strParameter = 3 Then
0368 If strCell = "-" Then
0369 strCell = "&nbsp;"
0370 Else
0371 strCell = Oboe_File_Links_List(strCell)
0372 End If
0373 End If
0374 If (strParameter = 3 And i > 1) Or (strParameter = 7 And i < 5) Or (strParameter = 8 And i > 2) Or (strParameter = 11 And i < 4) Then
0375 strElement = strElement & "<td class=""BridgeCenter"">" & strCell & "</td>"
0376 Else
0377 If strParameter = 11 And i = 4 Then
0378 If rs.Fields(1) = "0" Then
0379 strCell = "<b>Administration</b>|..||.|" & strCell & ": " & Language_Animadversion_Reference_List(rs.Fields(0))
0380 'Add old time
0381 strCell = strCell & Subject_Hours_List(rs.Fields(0))
0382 strQuery = "SELECT Language_Location_Primer.Language_Key, Language_Location_Primer.[Non_Latin_Script?], Language_Location_Primer.Ling_Progress FROM Language_Location_Primer WHERE (((Language_Location_Primer.Language_Key)=""" & rs.Fields(0) & """));"
0383 Set rs_Temp = CurrentDb.OpenRecordset(strQuery)
0384 rs_Temp.MoveFirst
0385 If rs_Temp.Fields(2) > 0 Then
0386 'Add latest Ling Lesson
0387 strCell = strCell & "|.|<b>Latest Ling Lesson Studied: </b>" & rs_Temp.Fields(2)
0388 'Add Links to Ling XTabs
0389 strCell = strCell & "|.|<b>Links to Aeon Comparative Database: </b>|99|"
0390 If rs_Temp.Fields(1) = True Then
0391 strCell = strCell & "|1|Vocabulary++1322#" & rs.Fields(0) & "++|1|Dialogues++1324#" & rs.Fields(0) & "Dialogue++"
0392 Else
0393 strCell = strCell & "|1|Vocabulary++1321#" & rs.Fields(0) & "++|1|Dialogues++1323#" & rs.Fields(0) & "Dialogue++"
0394 End If
0395 strCell = strCell & "|99|"
0396 Set rs_Temp = Nothing
0397 End If
0398 'Finish off
0399 strCell = strCell & "|..|"
0400 Else
0401 strCell = Language_Animadversion_Translate(strCell, rs.Fields(0))
0402 End If
0403 End If
0404 If (strParameter = 7 And i = 5) Or (strParameter = 8 And i = 2) Or (strParameter = 11 And i = 4) Or strParameter = 15 Or strParameter = 17 Or strParameter = 18 Or strParameter = 22 Or strParameter = 30 Or (strParameter = 21 And (Val(strParameter2_Local) <> 3)) Then
0405 strElement = strElement & "<td class=""BridgeLeft"">" & strCell & "</td>"
0406 Else
0407 If strParameter = 23 Then
0408 If i = 2 Or i = 4 Or i = 7 Then
0409 strElement = strElement & "<td class=""BridgeLeft"">" & strCell & "</td>"
0410 Else
0411 strElement = strElement & "<td class=""BridgeCenter"">" & strCell & "</td>"
0412 End If
0413 Else
0414 If strParameter = 24 Or strParameter = 25 Or strParameter = 28 Or strParameter = 29 Or strParameter = 31 Or strParameter = 32 Then
0415 strElement = strElement & "<td class=""BridgeLeft"">" & strCell & "</td>"
0416 Else
0417 If strParameter = 26 Then
0418 Select Case i
0419 Case 2, 3
0420 strElement = strElement & "<td class=""BridgeCenter"">" & strCell & "</td>"
0421 Case 4
0422 OK = Number_Format(strCell)
0423 strElement = strElement & "<td class=""BridgeRight"">" & strCell & "</td>"
0424 Case 5
0425 strCell = "&nbsp;"
0426 m = InStr(rs.Fields(0), "NotesPrint_")
0427 If m > 0 Then
0428 m = m + 11
0429 n = InStr(m, rs.Fields(0), "_")
0430 If n > 0 Then
0431 m = Mid(rs.Fields(0), m, n - m)
0432 strCell = "[Note Link]++" & m & "++"
0433 End If
0434 End If
0435 strElement = strElement & "<td class=""BridgeLeft"">" & strCell & "</td>"
0436 End Select
0437 Else
0438 strElement = strElement & "<td format="","">" & strCell & "</td>"
0439 End If
0440 End If
0441 End If
0442 End If
0443 End If
0444 If i = iTotal_Col Then
0445 'Row Total
0446 strCell = j
0447 If strParameter <> 3 Then
0448 OK = Number_Format(strCell)
0449 strElement = strElement & "<th>" & strCell & "</th>"
0450 End If
0451 k(iCols + 1) = k(iCols + 1) + j
0452 End If
0453 End Select
0454 Next i
0455 strElement = strElement & "</tr>" & Chr$(10)
0456 rs.MoveNext
0457Loop
0458strTable_Local = strTable_Local & strElement
0459'Set up Total Line
0460If iCols >= iTotal_Col Then 'Allow for no Total Row
0461 If strParameter = 3 Then
0462 strElement = "<tr><th class=""BridgeCenter"">TOTALS &rarr;</th>"
0463 Else
0464 strElement = "<tr><th>TOTAL</th>"
0465 End If
0466 For i = 2 To iCols
0467 strCell = k(i)
0468 If strParameter <> 3 Then
0469 OK = Number_Format(strCell)
0470 End If
0471 If strCell = 0 Then
0472 strCell = "&nbsp;"
0473 End If
0474 If strParameter = 3 Then
0475 If i < 5 Then
0476 strElement = strElement & "<th class=""BridgeCenter"">" & "&nbsp;" & "</th>"
0477 Else
0478 strElement = strElement & "<th class=""BridgeCenter"">" & strCell & "</th>"
0479 End If
0480 Else
0481 strElement = strElement & "<th>" & strCell & "</th>"
0482 If i = iTotal_Col Then
0483 strCell = k(iCols + 1)
0484 OK = Number_Format(strCell)
0485 strElement = strElement & "<th>" & strCell & "</th>"
0486 End If
0487 End If
0488 Next i
0489 strElement = strElement & "<tr>" & Chr$(10)
0490 strTable_Local = strTable_Local & strElement
0491End If
0492'Set up Table Footer
0493If strParameter = 3 Or strParameter = 11 Or strParameter = 22 Or (strParameter = 21 And (Val(strParameter2_Local) <> 3)) Then
0494 strTable_Local = strTable_Local & strHeader 'Repeat the column headers
0495End If
0496strElement = "</table>"
0497strTable_Local = strTable_Local & strElement
0498'Tidy up and exit
0499Functor_21 = "Yes"
0500strTable = strTable_Local
0501Set rs = Nothing
0502End Function

Procedures Calling This Procedure (Functor_21) Procedures Called By This Procedure (Functor_21) Tables / Queries / Fragments Directly Used By This Procedure (Functor_21) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_22
Procedure Type: Public Function
Module: Functors
Lines of Code: 289
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_22(strParameter, strList, Note_ID, str_Parameter_2, Optional str_Parameter_3, Optional str_Parameter_4) 'str_Parameter_3 & _4 to be used for recursion
0002'This function formats a list (together with surrounding narrative) from a query
0003Dim rs As Recordset
0004Dim strList_Local As String
0005Dim strElement As String
0006Dim strCell As String
0007Dim strQuery As String
0008Dim strUpdtQuery As String
0009Dim BP As String
0010Dim FN As String
0011Dim str_Parameter_2_Local As String
0012Dim str_Parameter_3_Local As String
0013Dim str_Parameter_4_Local As String
0014Dim strPara2 As String
0015Dim strPara3 As String
0016Dim Item_Year As String
0017Dim Write_Up_Note As Long
0018Dim Field_1 As String
0019Dim Field_2 As String
0020Dim Field_3 As String
0021Dim Field_4 As String
0022Dim Chapter_FieldName As String
0023str_Parameter_2_Local = str_Parameter_2 & ""
0024If IsMissing(str_Parameter_3) Then
0025 str_Parameter_3_Local = ""
0026Else
0027 str_Parameter_3_Local = str_Parameter_3 & ""
0028End If
0029If IsMissing(str_Parameter_4) Then
0030 str_Parameter_4_Local = ""
0031Else
0032 str_Parameter_4_Local = str_Parameter_4 & ""
0033End If
0034strPara3 = ""
0035'For Cases 6 to 7 ...
0036If strParameter >= 6 And strParameter <= 7 Then
0037 If automatic_processing <> "Yes" Then
0038 'Check Books & Papers on PID_Note_Reading_Lists exist!
0039 Set rs = CurrentDb.OpenRecordset("PID_Note_Reading_Lists_Books_Chk")
0040 If Not rs.EOF Then
0041 DoCmd.OpenQuery ("PID_Note_Reading_Lists_Books_Chk")
0042 End If
0043 Set rs = Nothing
0044 Set rs = CurrentDb.OpenRecordset("PID_Note_Reading_Lists_Papers_Chk")
0045 If Not rs.EOF Then
0046 DoCmd.OpenQuery ("PID_Note_Reading_Lists_Papers_Chk")
0047 End If
0048 Set rs = Nothing
0049 'Add new rows to PID_Note_Reading_Lists
0050 DoCmd.OpenQuery ("PID_Notes_Books_Referenced_Gen")
0051 DoCmd.OpenQuery ("PID_Notes_Papers_Referenced_Gen")
0052 DoCmd.OpenQuery ("IdentityBooks_Unreferenced_Gen")
0053 DoCmd.OpenQuery ("IdentityPapersRead_Unreferenced_Gen")
0054 ' Update/add the authors, titles and the "read" & "annotation" status of the papers on PID_Note_Reading_Lists
0055 strUpdtQuery = "UPDATE PID_Note_Reading_Lists INNER JOIN Papers ON PID_Note_Reading_Lists.Called_ID = Papers.ID SET PID_Note_Reading_Lists.[Read?] = [Papers]![Read?], PID_Note_Reading_Lists.Author = [Papers]![Author], PID_Note_Reading_Lists.Title = [Papers]![Title], PID_Note_Reading_Lists.[Annotations?] = [Papers]![Annotations?], PID_Note_Reading_Lists.[Abstract_Null?] = IIf([Abstract] & """"="""",True,False), PID_Note_Reading_Lists.[Link_Internal?] = IIf(InStr([Comments] & """",""+F"")>0,True,False), PID_Note_Reading_Lists.[Link_External?] = IIf(InStr([Comments] & """",""+W"")>0,True,False) WHERE (((PID_Note_Reading_Lists.[Book/Paper])=""Paper"") AND ((PID_Note_Reading_Lists.Note_ID)=" & Note_ID & "));"
0056 DoCmd.RunSQL (strUpdtQuery)
0057 ' Update/add the authors, titles and the "read" status of the books on PID_Note_Reading_Lists
0058 strUpdtQuery = "UPDATE PID_Note_Reading_Lists INNER JOIN Books ON PID_Note_Reading_Lists.Called_ID = Books.ID1 SET PID_Note_Reading_Lists.[Read?] = [Books]![Read?], PID_Note_Reading_Lists.Author = [Books]![Author], PID_Note_Reading_Lists.Title = [Books]![Title] WHERE (((PID_Note_Reading_Lists.[Book/Paper])=""Book"") AND ((PID_Note_Reading_Lists.Note_ID)=" & Note_ID & "));"
0059 DoCmd.RunSQL (strUpdtQuery)
0060 'Update to show Write-up Notes
0061 strUpdtQuery = "UPDATE PID_Note_Reading_Lists INNER JOIN Papers ON PID_Note_Reading_Lists.Called_ID = Papers.ID SET PID_Note_Reading_Lists.[Write-Up?] = [Papers]![Write_Up_Note_ID] WHERE (((Papers.Write_Up_Note_ID)>0) AND ((PID_Note_Reading_Lists.[Book/Paper])=""Paper"") AND ((PID_Note_Reading_Lists.Note_ID)=" & Note_ID & "));"
0062 DoCmd.RunSQL (strUpdtQuery)
0063 End If
0064 'Check if R/L to be de-duplicated
0065 If str_Parameter_3_Local = "De-Duplicate" Then
0066 'Determine the column name in PID_Note_Reading_Lists table
0067 strQuery = "SELECT Thesis_Chapters.ID, Thesis_Chapters.Chapter FROM Thesis_Chapters WHERE (((Thesis_Chapters.ID)=" & str_Parameter_4 & "));"
0068 Set rs = CurrentDb.OpenRecordset(strQuery)
0069 If Not rs.EOF Then
0070 rs.MoveFirst
0071 Chapter_FieldName = rs.Fields(1)
0072 Chapter_FieldName = "Ch_" & Chapter_FieldName & "_Ist_Note"
0073 strPara3 = " AND ((PID_Note_Reading_Lists." & Chapter_FieldName & ")<>999999)"
0074 End If
0075 Set rs = Nothing
0076 End If
0077End If
0078'For Cases 6 to 9 ...
0079If strParameter >= 6 And strParameter <= 9 Then
0080 'Over-ride Parameter_2 (Category) if requested, else select only that Category
0081 If str_Parameter_2_Local = "*ALL*" Then
0082 strPara2 = ""
0083 Else
0084 If str_Parameter_2_Local = "" Then
0085 strPara2 = " AND ((PID_Note_Reading_Lists.Category) & """" = """")"
0086 Else
0087 strPara2 = " AND ((PID_Note_Reading_Lists.Category)=""" & str_Parameter_2_Local & """)"
0088 End If
0089 End If
0090End If
0091Select Case strParameter
0092 Case 1
0093 strQuery = "Cross_Reference_By_Year"
0094 strElement = "However, there are (as of " & Now() & ", using +CFunctor_22C+ & query +QCross_Reference_By_YearQ+) the following counts of records on the table with timestamps in the years below:- "
0095 Case 2
0096 strQuery = "Cross_Reference_Changes_By_Year"
0097 strElement = ""
0098 Case 3
0099 DoCmd.OpenQuery ("Functor_Descriptions_GEN")
0100 strQuery = "Functor_Descriptions_List"
0101 strElement = ""
0102 Case 4
0103 strQuery = "Cross_Reference_Changes_By_Month"
0104 strElement = ""
0105 Case 5
0106 strQuery = "PID_Notes_Unused_By_Thesis"
0107 strElement = ""
0108 Case 6
0109 strQuery = "SELECT PID_Note_Reading_Lists.[Book/Paper], PID_Note_Reading_Lists.Called_ID, PID_Note_Reading_Lists.Footnote, PID_Note_Reading_Lists.Author, PID_Note_Reading_Lists.Title, PID_Note_Reading_Lists.Item_Year, PID_Note_Reading_Lists.[Write-Up?], PID_Note_Reading_Lists.[Annotations?], PID_Note_Reading_Lists.[Abstract_Null?], PID_Note_Reading_Lists.[Link_External?], PID_Note_Reading_Lists.[Link_Internal?] FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Read?]) = Yes) And ((PID_Note_Reading_Lists.[Suppress?]) = No)" & strPara2 & strPara3 & ") ORDER BY PID_Note_Reading_Lists.Author, PID_Note_Reading_Lists.Title;"
0110 strElement = ""
0111 Case 7
0112 strQuery = "SELECT PID_Note_Reading_Lists.[Book/Paper], PID_Note_Reading_Lists.Called_ID, PID_Note_Reading_Lists.Footnote, PID_Note_Reading_Lists.Author, PID_Note_Reading_Lists.Title, PID_Note_Reading_Lists.Item_Year, PID_Note_Reading_Lists.[Write-Up?], PID_Note_Reading_Lists.[Annotations?], PID_Note_Reading_Lists.[Abstract_Null?], PID_Note_Reading_Lists.[Link_External?], PID_Note_Reading_Lists.[Link_Internal?] FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Read?]) = No) And ((PID_Note_Reading_Lists.[Suppress?]) = No)" & strPara2 & strPara3 & ") ORDER BY PID_Note_Reading_Lists.Author, PID_Note_Reading_Lists.Title;"
0113 strElement = ""
0114 Case 8
0115 If str_Parameter_2_Local = "" Then
0116 strQuery = "SELECT PID_Note_Reading_Lists.Category FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Suppress?]) = No) And ((PID_Note_Reading_Lists.[Read?]) = Yes)) GROUP BY PID_Note_Reading_Lists.Category ORDER BY PID_Note_Reading_Lists.Category;"
0117 Else
0118 strQuery = "SELECT Mid([Category],Len(""" & str_Parameter_2_Local & """)+1) AS Expr2 FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Suppress?]) = No) And ((PID_Note_Reading_Lists.[Read?]) = Yes) And ((Left([Category], Len(""" & str_Parameter_2_Local & """))) = """ & str_Parameter_2_Local & """)) GROUP BY Mid([Category],Len(""" & str_Parameter_2_Local & """)+1) ORDER BY Mid([Category],Len(""" & str_Parameter_2_Local & """)+1);"
0119 End If
0120 strElement = ""
0121 Case 9
0122 If str_Parameter_2_Local = "" Then
0123 strQuery = "SELECT PID_Note_Reading_Lists.Category FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Suppress?]) = No) And ((PID_Note_Reading_Lists.[Read?]) = No)) GROUP BY PID_Note_Reading_Lists.Category ORDER BY PID_Note_Reading_Lists.Category;"
0124 Else
0125 strQuery = "SELECT Mid([Category],Len(""" & str_Parameter_2_Local & """)+1) AS Expr2 FROM PID_Note_Reading_Lists WHERE (((PID_Note_Reading_Lists.Note_ID) = " & Note_ID & ") And ((PID_Note_Reading_Lists.[Suppress?]) = No) And ((PID_Note_Reading_Lists.[Read?]) = No) And ((Left([Category], Len(""" & str_Parameter_2_Local & """))) = """ & str_Parameter_2_Local & """)) GROUP BY Mid([Category],Len(""" & str_Parameter_2_Local & """)+1) ORDER BY Mid([Category],Len(""" & str_Parameter_2_Local & """)+1);"
0126 End If
0127 strElement = ""
0128 Case 10
0129 If str_Parameter_2_Local = "Read" Then
0130 strPara2 = "((Functor_Usage.Functor_Option)=6 Or (Functor_Usage.Functor_Option)=8) "
0131 Else
0132 strPara2 = "((Functor_Usage.Functor_Option)=7 Or (Functor_Usage.Functor_Option)=9) "
0133 End If
0134 strQuery = "SELECT Thesis_Note_XRef.Thesis_Chapter_Note_ID, Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Thesis_Note_XRef.PID_Note_ID, Thesis_Note_XRef.PID_Note_Caption, Functor_Usage.Functor_Option, Functor_Usage.Functor_Parameter FROM Thesis_Note_XRef INNER JOIN Functor_Usage ON Thesis_Note_XRef.PID_Note_ID = Functor_Usage.Note_ID WHERE (" & strPara2 & " And ((Functor_Usage.Functor_ID) = 22) And ((Thesis_Note_XRef.Thesis_Chapter_Note_ID) = " & Note_ID & ") And ((Thesis_Note_XRef.[Exclude?]) = No)) ORDER BY Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Thesis_Note_XRef.PID_Note_Caption;"
0135 OK = Update_Thesis_Chapter_RLs(Note_ID)
0136 strElement = ""
0137 Case 11
0138 strQuery = "PID_Notes_Unused_By_Thesis_Note_Lists"
0139 strElement = ""
0140 Case 12
0141 strQuery = "PDF_File_List"
0142 strElement = ""
0143End Select
0144Set rs = CurrentDb.OpenRecordset(strQuery)
0145strList_Local = ""
0146If rs.EOF Then
0147 Set rs = Nothing
0148 Debug.Print Now(); "- Functor_22: Option " & strParameter & " (Note = " & Note_ID & ") - No list to print"
0149 If strParameter = 6 Or strParameter = 7 Then
0150 strElement = "|ii|"
0151 strElement = strElement & "|1|No items to list. "
0152 strElement = strElement & "|ii|"
0153 Functor_22 = "Yes"
0154 strList = strElement
0155 Else
0156 Functor_22 = "No"
0157 End If
0158 Exit Function
0159Else
0160 rs.MoveFirst
0161End If
0162'Set up List Header
0163Select Case strParameter
0164 Case 6, 7
0165 strElement = strElement & "|ii|"
0166 Case 10
0167 strElement = "|II|"
0168 Field_3 = ""
0169 Field_4 = ""
0170 Case Else
0171 strElement = strElement & "|##|"
0172End Select
0173strList_Local = strList_Local & strElement
0174strElement = ""
0175Do Until rs.EOF
0176 Field_2 = ""
0177 Select Case strParameter
0178 Case 5, 11
0179 strElement = strElement & "|.|"
0180 strElement = strElement & rs.Fields(0)
0181 Case 6, 7
0182 strElement = strElement & "|1|"
0183 BP = Left(rs.Fields(0), 1)
0184 strElement = strElement & "+" & BP & rs.Fields(1) & BP & "+"
0185 Item_Year = rs.Fields(5) & ""
0186 If Item_Year <> "" Then
0187 strElement = strElement & ", " & Item_Year
0188 End If
0189 Write_Up_Note = rs.Fields(6)
0190 If Write_Up_Note > 0 Then
0191 strElement = strElement & ", [Write-Up Note]++" & Write_Up_Note & "++"
0192 End If
0193 If rs.Fields(7) = True Then
0194 strElement = strElement & ", Annotations"
0195 End If
0196 If rs.Fields(8) = True Then
0197 strElement = strElement & ", No Abstract"
0198 End If
0199 If rs.Fields(9) = True Then
0200 strElement = strElement & ", External Link"
0201 End If
0202 If rs.Fields(10) = True Then
0203 strElement = strElement & ", Internal PDF Link"
0204 End If
0205 FN = rs.Fields(2) & ""
0206 If FN <> "" Then
0207 If (Len(FN) < 31) And InStr(FN, "|") = 0 And InStr(FN, "+") = 0 Then 'Allow for quick comment / characterisation, eg. "Aeon" or "August 2019"
0208 strElement = strElement & ", Note: " & FN
0209 Else
0210 If InStr(FN, "|") = 0 Then
0211 FN = "|..||.|" & FN & "|..|"
0212 End If
0213 strElement = strElement & ", Footnote++FN" & FN & "++"
0214 End If
0215 End If
0216 Case 8, 9
0217 strElement = strElement & "|.|"
0218 strElement = strElement & "<b>" & IIf(rs.Fields(0) & "" = "", "General", rs.Fields(0)) & "</b>: "
0219 OK = Functor_22(IIf(strParameter = 8, 6, 7), strCell, Note_ID, str_Parameter_2_Local & rs.Fields(0), str_Parameter_3_Local, str_Parameter_4_Local)
0220 strElement = strElement & strCell
0221 Case 10
0222 If rs.Fields(3) & "" <> Field_4 Then
0223 If Field_4 <> "" Then
0224 Field_2 = Field_2 & "|oo|"
0225 End If
0226 If rs.Fields(3) & "" <> "" Then
0227 Field_2 = Field_2 & "|1|" & rs.Fields(3)
0228 End If
0229 Field_4 = rs.Fields(3) & ""
0230 If Field_4 <> "" Then
0231 Field_2 = Field_2 & "|oo|"
0232 End If
0233 End If
0234 If rs.Fields(2) & "" <> Field_3 Then
0235 If Field_3 <> "" Then
0236 Field_2 = Field_2 & "|AA|"
0237 End If
0238 If rs.Fields(2) & "" <> "" Then
0239 Field_2 = Field_2 & "|1|" & rs.Fields(2) & "|AA|"
0240 End If
0241 Field_3 = rs.Fields(2) & ""
0242 End If
0243 Field_1 = rs.Fields(5)
0244 Select Case Field_1
0245 Case "1"
0246 Field_2 = Field_2 & "|1|"
0247 Case "2"
0248 Field_2 = Field_2 & "|1|"
0249 Case "3"
0250 Field_2 = Field_2 & "|.|"
0251 End Select
0252 Field_2 = Field_2 & "<b>[" & rs.Fields(7) & "]++" & rs.Fields(6) & "++</b>"
0253 strElement = strElement & Field_2
0254 OK = Functor_22(rs.Fields(8), strCell, rs.Fields(6), rs.Fields(9) & "", "De-Duplicate", rs.Fields(0))
0255 strElement = strElement & strCell
0256 Case 12
0257 strElement = strElement & Chr$(10)
0258 strElement = strElement & "|.|" & "<a name=""Off-Page_Link_" & rs.Fields(1) & """></a>" & "<a href = ""../../PDFs/" & rs.Fields(1) & ".pdf"">" & rs.Fields(1) & ".pdf</a> " & rs.Fields(0)
0259 Case Else
0260 strElement = strElement & "|.|"
0261 strElement = strElement & "<b>" & rs.Fields(0) & "</b>: "
0262 strCell = rs.Fields(1)
0263 OK = Number_Format(strCell)
0264 strElement = strElement & strCell
0265 End Select
0266 rs.MoveNext
0267Loop
0268strList_Local = strList_Local & strElement
0269'Set up End List
0270Select Case strParameter
0271 Case 6, 7
0272 strElement = "|ii|"
0273 Case 10
0274 strElement = ""
0275 If Field_4 <> "" Then
0276 strElement = strElement & "|oo|"
0277 End If
0278 If Field_3 <> "" Then
0279 strElement = strElement & "|AA|"
0280 End If
0281 strElement = strElement & "|II|"
0282 Case Else
0283 strElement = "|##|"
0284End Select
0285strList_Local = strList_Local & strElement
0286Functor_22 = "Yes"
0287strList = strList_Local
0288Set rs = Nothing
0289End Function

Procedures Calling This Procedure (Functor_22) Procedures Called By This Procedure (Functor_22) Tables / Queries / Fragments Directly Used By This Procedure (Functor_22) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_23
Procedure Type: Public Function
Module: Functors
Lines of Code: 288
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_23(Note_ID, strOption, strValue, Optional str_Parameter_2)
0002'This function either
0003' ... (Options 1-14 & 21-23) returns a value (together with surrounding narrative) from a query, or
0004' ... (Options 15-19) produce an indented list from a query
0005' ... (Option 20) produces the table for the Thesis Dashboard
0006Dim rs As Recordset
0007Dim strValue_Local As String
0008Dim strElement As String
0009Dim strMsg As String
0010Dim strQuery As String
0011Dim Field_1 As String
0012Dim Field_2 As String
0013Dim Field_3 As String
0014Dim i As Integer
0015Dim j As Integer
0016Dim str_Parameter_2_Local As String
0017Dim strPara2 As String
0018If IsMissing(str_Parameter_2) Then
0019 str_Parameter_2_Local = ""
0020Else
0021 str_Parameter_2_Local = str_Parameter_2
0022End If
0023Select Case strOption
0024 Case "1"
0025 strQuery = "Dud_Cross_References_This_Year"
0026 Case "2"
0027 strQuery = "Cross_Reference_MaxID"
0028 Case "3"
0029 strQuery = "SELECT Count(Cross_Reference_Changes.ID) AS CountOfID FROM Cross_Reference_Changes;"
0030 Case "4"
0031 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""Paper_Abstract_Ranges""));"
0032 Case "5"
0033 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""Author_Letters""));"
0034 Case "6"
0035 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""BookPaperAbstract_Ranges""));"
0036 Case "7"
0037 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""Note_Regen_Ranges""));"
0038 Case "8"
0039 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""Note_Archive_Regen_Ranges""));"
0040 Case "9"
0041 strQuery = "SELECT * FROM Oboe_Latest_Lesson;"
0042 Case "10"
0043 strQuery = "SELECT BookPaperControl.Time_To_Regenerate, BookPaperControl.Latest_Update FROM BookPaperControl WHERE (((BookPaperControl.[ID])=""Auto_Reference_Notes_Regen""));"
0044 Case "11"
0045 strQuery = "Hits_Pages_Totals"
0046 Case "12"
0047 strQuery = "Hits_Pages_Totals_LastYear"
0048 Case "13"
0049 strQuery = "SELECT Count(Site_Map.Size) AS Records, Max([Timestamp_Logged]) AS [As At] FROM Site_Map;"
0050 Case "14"
0051 strQuery = "SELECT Website_Regen_Control.Regen_Mins, Website_Regen_Control.Last_Run, Website_Regen_Control.Division FROM Website_Regen_Control WHERE (((Website_Regen_Control.Division)=""Book_Summary_Ranges""));"
0052 Case "15"
0053 Select Case str_Parameter_2_Local
0054 Case "1"
0055 strQuery = "Earliest_Lang_Dates"
0056 Case "2"
0057 strQuery = "Ling_Progress"
0058 End Select
0059 Case "16", "18"
0060 strQuery = "SELECT Thesis_Note_XRef.Thesis_Chapter_Note_ID, Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Notes.Item_Title, Thesis_Note_XRef.PID_Note_ID, Thesis_Note_XRef.PID_Note_Caption, Thesis_Note_XRef.PID_Footnote, Thesis_Note_XRef.[Exclude?], Thesis_Note_XRef.Reason_Excluded FROM Thesis_Note_XRef INNER JOIN Notes ON Thesis_Note_XRef.PID_Note_ID = Notes.ID WHERE (((Thesis_Note_XRef.Thesis_Chapter_Note_ID) = " & Note_ID & ")) ORDER BY Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Notes.Item_Title;"
0061 Case "17", "19"
0062 If str_Parameter_2_Local = "Read" Then
0063 strPara2 = "((Functor_Usage.Functor_Option)=6 Or (Functor_Usage.Functor_Option)=8) "
0064 Else
0065 strPara2 = "((Functor_Usage.Functor_Option)=7 Or (Functor_Usage.Functor_Option)=9) "
0066 End If
0067 strQuery = "SELECT Thesis_Note_XRef.Thesis_Chapter_Note_ID, Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Notes.Item_Title, Thesis_Note_XRef.PID_Note_ID, Thesis_Note_XRef.PID_Note_Caption, Functor_Usage.Functor_Option, Functor_Usage.Functor_Parameter FROM (Thesis_Note_XRef INNER JOIN Functor_Usage ON Thesis_Note_XRef.PID_Note_ID = Functor_Usage.Note_ID) INNER JOIN Notes ON Thesis_Note_XRef.PID_Note_ID = Notes.ID WHERE (" & strPara2 & " And ((Thesis_Note_XRef.Thesis_Chapter_Note_ID) = " & Note_ID & ") And ((Functor_Usage.Functor_ID) = 22) And ((Thesis_Note_XRef.[Exclude?]) = No)) ORDER BY Thesis_Note_XRef.PID_Note_Seq, Thesis_Note_XRef.PID_Note_Category_1, Thesis_Note_XRef.PID_Note_Category_2, Thesis_Note_XRef.PID_Note_Category_3, Thesis_Note_XRef.PID_Note_Level, Thesis_Note_XRef.PID_Note_Caption;"
0068 Case "20"
0069 strQuery = "Thesis_Progress_Dashboard_List"
0070 Case "21"
0071 Select Case str_Parameter_2_Local
0072 Case "1"
0073 strQuery = "PID_Notes_Unused_By_Thesis_Count"
0074 Case "2"
0075 strQuery = "PID_Notes_Unused_By_Thesis_Note_Lists_Count"
0076 Case "3"
0077 strQuery = "IdentityBooks_Unreferenced_Count"
0078 Case "4"
0079 strQuery = "IdentityPapersRead_Unreferenced_Count"
0080 Case "5"
0081 strQuery = "Works_Missing_By_Thesis_Chapter_Count"
0082 Case "6"
0083 strQuery = "PID_Papers_Filed_Not_Referenced_Count"
0084 Case "7"
0085 strQuery = "PID_Papers_Referenced_Undated_Count"
0086 Case "8"
0087 strQuery = "PID_Papers_Referenced_No_Abstract_Count"
0088 Case "9"
0089 strQuery = "Large_Page_List_Count"
0090 Case "10"
0091 strQuery = "PDF_Missing_List_Count"
0092 Case "11"
0093 strQuery = "Duplicate_Papers_Count"
0094 Case "12"
0095 strQuery = "PDF_File_List_Count"
0096 Case "13"
0097 strQuery = "Missing_Webref_DisplayText_List_Count"
0098 Case "14"
0099 strQuery = "PID_Missing_Online_Papers_List_Count"
0100 Case "15"
0101 strQuery = "Missing_Webref_DisplayText_List_Books_Count"
0102 Case "16"
0103 strQuery = "Papers_Inconsistently_Electronic_Count"
0104 End Select
0105 Case "22"
0106 strQuery = "SELECT PID_Missing_Online_Papers_List.[PID Note], Sum(1) AS Total, Sum(IIf([Accept?]=""Yes"",1,0)) AS Accepted, Sum(IIf([Pending?]=""Yes"",1,0)) AS Pending, Sum(IIf([Reserve?]=""Yes"",1,0)) AS Reserve FROM PID_Missing_Online_Papers_List WHERE (((PID_Missing_Online_Papers_List.[PID Note]) Like ""*+" & Note_ID & "+*"")) GROUP BY PID_Missing_Online_Papers_List.[PID Note];"
0107 Case "23"
0108 Select Case str_Parameter_2_Local
0109 Case "1"
0110 strQuery = "PID_Pages_Total"
0111 Case "2"
0112 strQuery = "Paper_Pages_Total"
0113 End Select
0114 Case Else
0115 Debug.Print Now(); "- Note: " & Note_ID & ". Functor_23 : Invalid Option : " & strOption
0116 Functor_23 = "No"
0117 Exit Function
0118End Select
0119If strOption <> "20" Then
0120 Set rs = CurrentDb.OpenRecordset(strQuery)
0121 strValue_Local = ""
0122 If rs.EOF Then
0123 Debug.Print Now(); "- Note: " & Note_ID & ". Functor_23 : No item to print (Option = " & strOption & ")"
0124 Functor_23 = "No"
0125 Exit Function
0126 End If
0127End If
0128Select Case strOption
0129 Case "1"
0130 rs.MoveLast
0131 strElement = rs.Fields(1)
0132 If rs.Fields(0) <> rs.Fields(2) Then
0133 strElement = 0
0134 End If
0135 If strElement = 0 Then
0136 strElement = "no"
0137 strMsg = "encouraging."
0138 Else
0139 strMsg = "<b>worrying. <u>Investigate</u>!</b>"
0140 Debug.Print Now(); "Note: " & Note_ID & ". Functor_23, Option 1 : Non-zero value printed - Investigate!"
0141 End If
0142 strValue_Local = strElement & " record" & IIf(Val(strElement) > 1, "s", "") & " for " & rs.Fields(2) & " prior to the " & rs.Fields(3) & " regeneration, which is " & strMsg
0143 Case "2"
0144 rs.MoveFirst
0145 strElement = rs.Fields(0)
0146 OK = Number_Format(strElement)
0147 strValue_Local = Now() & " it is " & strElement & " - but it's taken " & Year(Now) - 2015
0148 Case "3"
0149 rs.MoveFirst
0150 strElement = rs.Fields(0)
0151 OK = Number_Format(strElement)
0152 strValue_Local = strElement & " rows, as of " & Left(Now(), 10) & ", "
0153 Case "4", "5", "6", "7", "8", "10", "14"
0154 rs.MoveFirst
0155 strElement = rs.Fields(0)
0156 If strElement >= 60 Then
0157 strElement = Round(strElement / 60, 2) & " hours"
0158 Else
0159 strElement = strElement & " minutes"
0160 End If
0161 strElement = strElement & " on " & Left(rs.Fields(1), 10)
0162 strValue_Local = strElement
0163 Case "9"
0164 rs.MoveFirst
0165 strValue_Local = rs.Fields(0) & ""
0166 Case "11", "12"
0167 rs.MoveFirst
0168 Field_1 = rs.Fields(0) 'Min period recorded
0169 Field_2 = rs.Fields(1) 'Max period recorded
0170 Field_3 = rs.Fields(2) 'Total Hits
0171 Field_1 = Left(Field_1, 4) * 12 + Right(Field_1, 2)
0172 Field_2 = Left(Field_2, 4) * 12 + Right(Field_2, 2)
0173 Field_1 = Field_2 - Field_1 + 1
0174 Field_2 = Field_1 * 365 / 12
0175 Field_3 = Round(Field_3 / Field_2 / 1000, 1)
0176 strValue_Local = Field_3 & "k or so hits a day over the " & Field_1 & " months up to " & rs.Fields(1)
0177 Case "13"
0178 rs.MoveFirst
0179 strValue_Local = Round(rs.Fields(0) / 1000, 0) & "k pages on my site as at " & Left(rs.Fields(1), 10)
0180 Case "15"
0181 rs.MoveFirst
0182 Select Case str_Parameter_2_Local
0183 Case "1"
0184 strValue_Local = "The next languages in the queue are:- |..|"
0185 Field_3 = ""
0186 Case "2"
0187 strValue_Local = "Progress on Ling (in progress order):- |..|"
0188 Field_2 = ""
0189 End Select
0190 Do Until rs.EOF
0191 Select Case str_Parameter_2_Local
0192 Case "1"
0193 Field_1 = rs.Fields(0) & rs.Fields(1)
0194 Field_2 = rs.Fields(2)
0195 If Field_2 = "0" Then
0196 Field_2 = "Not yet studied"
0197 Else
0198 Field_2 = "Last studied on " & Format(Field_2, "Long Date")
0199 If rs.Fields(4) & "" > "0" Then
0200 Field_2 = Field_2 & "; Last Ling Lesson = " & rs.Fields(4)
0201 End If
0202 If rs.Fields(5) & "" <> "" Then
0203 Field_2 = Field_2 & "; Last Ling Revision = " & rs.Fields(5)
0204 End If
0205 End If
0206 If Field_3 <> Field_1 Then
0207 If Field_3 <> "" Then
0208 strValue_Local = strValue_Local & "|99|"
0209 End If
0210 strValue_Local = strValue_Local & "|.|<b>" & rs.Fields(0) & ": Priority " & rs.Fields(1) & "</b>: |99|"
0211 End If
0212 strValue_Local = strValue_Local & "|1|<b>" & Replace(rs.Fields(3), " (Modern)", "") & "</b>. " & Field_2
0213 Field_3 = Field_1
0214 Case "2"
0215 Field_1 = rs.Fields(0)
0216 If Field_2 <> Field_1 Then
0217 If Field_2 <> "" Then
0218 strValue_Local = strValue_Local & "|99|"
0219 End If
0220 strValue_Local = strValue_Local & "|.|<b>Priority " & Field_1 & "</b>:- |99|"
0221 End If
0222 strValue_Local = strValue_Local & "|1|<b>" & rs.Fields(2) & "</b>: " & rs.Fields(1) & IIf(rs.Fields(3) & "" <> "", " (Revision: " & rs.Fields(3) & ")", "")
0223 Field_2 = Field_1
0224 End Select
0225 rs.MoveNext
0226 Loop
0227 strValue_Local = strValue_Local & "|99||..|"
0228 Case "16"
0229 OK = Functor_Indented_List(rs, strValue_Local)
0230 Case "17"
0231 OK = Update_Thesis_Chapter_RLs(Note_ID)
0232 OK = Functor_Indented_List(rs, strValue_Local, True)
0233 Case "18" 'Test only
0234 OK = Functor_Indented_List_Development(rs, strValue_Local)
0235 Case "19"
0236 OK = Update_Thesis_Chapter_RLs(Note_ID)
0237 OK = Functor_Indented_List_Development(rs, strValue_Local, True)
0238 Case "20"
0239 OK = Thesis_Dashboard_Table_Gen(strValue_Local, strQuery)
0240 Case "21"
0241 rs.MoveFirst
0242 strElement = rs.Fields(0)
0243 If str_Parameter_2_Local = "6" Then
0244 Field_1 = Nz(rs.Fields(1))
0245 End If
0246 OK = Number_Format(strElement)
0247 strValue_Local = "(" & strElement & " item" & IIf(strElement = 1, "", "s") & IIf(str_Parameter_2_Local = "6", ", " & Field_1 & " unactioned", "") & ")"
0248 Case "22"
0249 If rs.EOF Then
0250 strValue_Local = ""
0251 Else
0252 strValue_Local = "|.|"
0253 Field_1 = rs.Fields(0)
0254 Field_1 = Mid(Field_1, 2, InStr(Field_1, "]") - 2)
0255 Field_1 = Replace(Field_1, " ", "")
0256 'Field_1 = "PDFs_" & Field_1
0257 Field_1 = Left("PDFs_" & Field_1, 20)
0258 Field_1 = "For further papers held on-line of potential interest, follow this Link++1317#" & Field_1 & "++."
0259 i = rs.Fields.Count
0260 Field_1 = Field_1 & " Total papers = " & rs.Fields(1)
0261 If i > 2 Then
0262 Field_1 = Field_1
0263 Field_3 = ". Including "
0264 j = 2
0265 Field_2 = ""
0266 Do Until j > i - 1
0267 If rs.Fields(j) > 0 Then
0268 Field_1 = Field_1 & Field_3 & Field_2 & rs.Fields(j).Name & " = " & rs.Fields(j)
0269 Field_2 = ", "
0270 Field_3 = ""
0271 End If
0272 j = j + 1
0273 Loop
0274 Field_1 = Field_1 & "."
0275 End If
0276 strValue_Local = strValue_Local & Field_1
0277 End If
0278 Case "23"
0279 rs.MoveFirst
0280 strElement = rs.Fields(0)
0281 strElement = Round(strElement / 1000, 0)
0282 OK = Number_Format(strElement)
0283 strValue_Local = strElement & "k pages, as at " & Now()
0284 End Select
0285Functor_23 = "Yes"
0286strValue = strValue_Local
0287Set rs = Nothing
0288End Function

Procedures Calling This Procedure (Functor_23) Procedures Called By This Procedure (Functor_23) Tables / Queries / Fragments Directly Used By This Procedure (Functor_23) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Jacks_Non_Prime
Procedure Type: Public Sub
Module: Testing
Lines of Code: 36
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Sub Jacks_Non_Prime()
0002'Prove that 2^10 + 5^12 is non-prime
0003'The program shows:-
0004'... The number is 244,141,649 = 14657 x 16657
0005'... Max Long is 2,147,483,647, so didn't need LongLong
0006Dim Non_Prime As LongLong
0007Dim Non_Prime_Temp As LongLong
0008Dim Non_Prime_Sqrt As Integer
0009Dim i As Integer
0010Non_Prime_Temp = 1
0011For i = 1 To 10
0012 Non_Prime_Temp = Non_Prime_Temp * 2
0013Next i
0014Debug.Print Non_Prime_Temp
0015Non_Prime = Non_Prime_Temp
0016Non_Prime_Temp = 1
0017For i = 1 To 12
0018 Non_Prime_Temp = Non_Prime_Temp * 5
0019Next i
0020Debug.Print Non_Prime_Temp
0021Non_Prime = Non_Prime + Non_Prime_Temp
0022Debug.Print Non_Prime
0023Non_Prime_Sqrt = Non_Prime ^ 0.5
0024Debug.Print Non_Prime_Sqrt
0025Non_Prime_Sqrt = Non_Prime_Sqrt / 2 + 1
0026For i = 1 To Non_Prime_Sqrt
0027 Non_Prime_Temp = Non_Prime Mod (2 * i + 1)
0028 If Non_Prime_Temp = 0 Then
0029 Debug.Print 2 * i + 1
0030 Non_Prime_Temp = Non_Prime / (2 * i + 1)
0031 Debug.Print Non_Prime_Temp
0032 Non_Prime_Temp = Non_Prime_Temp * (2 * i + 1)
0033 Debug.Print Non_Prime_Temp
0034 End If
0035Next i
0036End Sub

Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Number_Format
Procedure Type: Public Function
Module: New Code
Lines of Code: 39
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Number_Format(strNumber_Sent)
0002Dim strNumber_Local As String
0003Dim Digit_Table(20) As String
0004Dim i As Integer
0005Dim j As Integer
0006Dim iLen_Number As Integer
0007'This function inserts commas into a number sent ...
0008'I may get it to do further functions in due course
0009' .... I couldn't find an HTML format command to do this
0010' .... but there must be a VBA built-in function?
0011strNumber_Local = Trim(strNumber_Sent)
0012If Not IsNumeric(strNumber_Local) Then
0013 Exit Function
0014End If
0015iLen_Number = Len(strNumber_Local)
0016For i = 1 To 20
0017 Digit_Table(i) = ""
0018Next i
0019'Add the commas (in reverse)
0020j = 1
0021For i = 1 To iLen_Number
0022 Digit_Table(j) = Mid(strNumber_Local, iLen_Number + 1 - i, 1)
0023 j = j + 1
0024 If i Mod 3 = 0 Then
0025 Digit_Table(j) = ","
0026 j = j + 1
0027 End If
0028Next i
0029'Remove trailing comma
0030If Digit_Table(j - 1) = "," Then
0031 Digit_Table(j - 1) = ""
0032End If
0033strNumber_Local = ""
0034For i = 1 To j - 1
0035 strNumber_Local = strNumber_Local & Digit_Table(j - i)
0036Next i
0037'Exit
0038strNumber_Sent = strNumber_Local
0039End Function

Procedures Calling This Procedure (Number_Format) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



© Theo Todman, June 2007 - Nov 2021. Please address any comments on this page to theo@theotodman.com. File output:
Website Maintenance Dashboard
Return to Top of this Page Return to Theo Todman's Philosophy Page Return to Theo Todman's Home Page