I have a form called InvestmentF based on a table InvestmentF with the following fields
Investor Name
InvestorID
InvestmentDate
MaturityDate
What I want to is that on load, Access should look through the recordsets and check for Investments which would mature on the MaturityDate and display a continuous pop Message for all matured investments
I guess Do loop would help but cannot really figure out how to go about it.
This is the code I have so far but it just open the form and does nothing!
I would appreciate if there is another way to do this.
Investor Name
InvestorID
InvestmentDate
MaturityDate
What I want to is that on load, Access should look through the recordsets and check for Investments which would mature on the MaturityDate and display a continuous pop Message for all matured investments
I guess Do loop would help but cannot really figure out how to go about it.
This is the code I have so far but it just open the form and does nothing!
I would appreciate if there is another way to do this.
Code:
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim StrMsgBox As String
DoCmd.OpenForm "investmentF"
DoCmd.SetWarnings True
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("InvestmentF", dbOpenTable)
rst.MoveFirst
Do While Not rst.EOF
If Not MaturityDate = Date Then Exit Sub
StrMsgBox = MsgBox("An Investment would matured today! Do you want to go to client's Record? ClientName is" & FullName, vbInformation + vbYesNoCancel, "Matured Investment")
If StrMsgBox <> vbYes Then Exit Sub
DoCmd.OpenForm "InvestmentF"
DoCmd.GoToControl "FullName"
rs.MoveNext
Loop
MsgBox "Finished searching for Matured investments"
rs.Close
Set rs = Nothing
End Sub
Comment