|
Question : strName and msgbox
|
|
Hello,
I have the following code that has worked just fine until I added strName8. I have a query "qrySentToEx-ImQuestionsforMsgBox", found on the line strName8, that does work because I have a record in the query (a hit) and I expect the "Name" and the date to appear in the msgbox just like all the other ones when I open the form.
Again, I have not had any issues with this until I tried to add strName8 follow what was done before. Does anybody see something wrong with the code? Mainly strName8 lines. I have not added a line to this in a couple months and I always test to make sure it works so all strNames preceding strName8 work. Maybe there is a limit to the # of strNames.
Private Sub Form_Open(Cancel As Integer) DoCmd.Maximize On Error Resume Next
Dim strName As String Dim strName2 As String Dim strName3 As String Dim strName4 As String Dim strName5 As String Dim strName6 As String Dim strName7 As String Dim strName8 As String
Const cS = vbCrLf
strName = CurrentProject.Connection.Execute("SELECT Name FROM qryCreditCommitteeMsgBox").GetString(2, , "", cS) strName2 = CurrentProject.Connection.Execute("SELECT Name FROM qryCreditReportsforMsgBox").GetString(2, , "", cS) strName3 = CurrentProject.Connection.Execute("SELECT Name, SenttoEIB FROM qrySentToExImMsgBox").GetString(2, , " : ", cS) strName4 = CurrentProject.Connection.Execute("SELECT Name FROM qryBridgeMaturityMsgBox").GetString(2, , " : ", cS) strName5 = CurrentProject.Connection.Execute("SELECT Name, IIF(ISDATE(FinalDisbursementDate) AND ISDATE(AmendedFinalDisbursementDate),IIF(FinalDisbursementDate>AmendedFinalDisbursementDate,FinalDisbursementDate,AmendedFinalDisbursementDate),IIF(nz(FinalDisbursementDate,'')='',AmendedFinalDisbursementDate, FinalDisbursementDate)) FROM qryFinalMaturityperPolicyforMsgBox").GetString(2, , " : ", cS) strName6 = CurrentProject.Connection.Execute("SELECT Name, FinalMaturityDate FROM qryFinalMaturityDateWU").GetString(2, , " : ", cS) strName7 = CurrentProject.Connection.Execute("SELECT Name, QstnsDueDate FROM qryQuestionsDueSoonForMsgBox").GetString(2, , " : ", cS) strName8 = CurrentProject.Connection.Execute("SELECT Name, QstnsSentDate FROM qrySentToEx-ImQuestionsforMsgBox").GetString(2, , " : ", cS)
If Len(strName & strName2 & strName3 & strName4 & strName5 & strName6 & strName7 & strName8) > 0 Then MsgBox IIf(Len(strName) > 0, "Credit Committe Submittted: " & cS & _ "-----------------------------------------" & cS & strName & " " & cS & cS, "") & _ IIf(Len(strName2) > 0, "Credit Reports Oustanding: " & cS & _ "-----------------------------------------" & cS & strName2 & " " & cS & cS, "") & _ IIf(Len(strName3) > 0, "Sent to Ex-Im Bank: " & cS & _ "-----------------------------------------" & cS & strName3 & " " & cS & cS, "") & _ IIf(Len(strName4) > 0, "Bridge Loan FDD, notify Ro: " & cS & _ "-----------------------------------------" & cS & strName4 & " " & cS & cS, "") & _ IIf(Len(strName5) > 0, "Final Disbursement per Policy Near: " & cS & _ "-----------------------------------------" & cS & strName5 & " " & cS & cS, "") & _ IIf(Len(strName6) > 0, "^^Modify the FMD in WU & DT:^^" & cS & _ "-----------------------------------------" & cS & strName6 & " " & cS & cS, "") & _ IIf(Len(strName7) > 0, "Questions Due within 5 days: " & cS & _ "-----------------------------------------" & cS & strName7 & " " & cS & cS, "") & _ IIf(Len(strName8) > 0, "Answers Sent to Ex-Im recently : " & cS & _ "-----------------------------------------" & cS & strName8 & " ", ""), vbOKOnly + vbCritical, "Reminder"
End If End Sub
|
|
Answer : strName and msgbox
|
|
Hmm, try to change the save queryname from "qrySentToEx-ImQuestionsforMsgBox" into e.g. "qrySentToExImQuestionsforMsgBox" and try again.
Some Access versions don´t like a "-" in names.....
Nic;o)
|
|
|
|