I have created a message box that is a like a reminder and pops up when my switchboard opens on my database.
the message box tells me how many customers havent paid for their order in 25 days. I have put the code into the On Load Section of the switchboard.
However, when i click into my switchboard the code runs instantly which is expected and the message box appears saying "There are x uncompleted payments that have not been paid in 25 days, would you like to see these now" and there is a yes or no button.
But when this box loads and i click yes my switchboard and query opens at the same time and it automatically directs me to the switchboard and not the query that i want to see on my screen. I am aiming to have the main menu open, delay the code for a certain amount of seconds then opens the query if i select yes.
This is the code i have produced.
Public Sub Form_Load()
Dim time1, time2
time1 = Now
time2 = Now + TimeValue("0:00:05")
Do Until time1 >= time2
time1 = Now()
Loop
Dim OS As Integer
OS = DCount("[Paid]", "[OutstandingPayments]", "DateDiff('d', DateOrder,
Now()) > 25")
If OS = 0 Then
Exit Sub
Else
If MsgBox("There are " & OS & " uncompleted Payments that have not been paid in 25 days" & _
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Uncomplete Payments...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenQuery "OutstandingPayments", acNormal
Else
Exit Sub
End If
End If
End Sub
Basically what this code does is just delay the code being produced but i thought the switchboard could open showing the screen then the code would run and then display my message box.
is there a way i can be able to open switchboard on load, have it loaded then for my code to run to display my message box.
Gif attached to illustrate problem https://gyazo.com/94f7e56cbe9220673d10a810e5282dda
Thank you.