Message Box Pops Up Before Form

Something like
Code:
DIM asWhere as String
asWhere = "ReminderDate < #" & date() & "#"
TxtFirst = nz(DLookup("ReminderDate", tblReminders, asWhere), "NONE FOUND")
DLookup returns NULL if no records match.

I'm getting 'variable not defined' on tblReminders.
 
tblReminders needs to be in quotation marks within the DLookup;

Code:
TxtFirst = nz(DLookup("ReminderDate", [COLOR="Red"]"[/COLOR]tblReminders[COLOR="red"]"[/COLOR], asWhere), "NONE FOUND")
 
What is TextFirst representing?
 
Not to speak for Mark but I believe he was suggesting that you use a control (like a text box) on your form to either display the message, or to be a trigger for the message box. So txtFirst is a hypothetical text box on your form.

Personally, I'm not sure why you need any of this. You said in an earlier post that this form doesn't display any records, it's more of a main form. If that's the case why not just use a list box with a row source that returns all records with a reminder date less than the current date? Clean and simple, no code or additional message boxes needed.

Just a thought.
 
Again, this form DOES NOT display any text fields form the table it is based on.
 
The form isn't showing any records.

I based the form on tblReminders so I can reference ReminderDate in tblReminders.

If ReminderDate for na record in tblReminders is less than Today (past due) I want the message box to tell me.

hi, have you tried the OnTimer event of form?

I have used once something like this:
Private Sub Form_Open(Cancel As Integer)
Me.TimerInterval = 2
End Sub

Private Sub Form_Timer()
Me.TimerInterval = 0
If Me!ReminderDate > Date Then
MsgBox "Past Due Reminders"
End If
End Sub

I may be wrong but you could give it a try..
 
THis code:

Code:
 If Me!ReminderDate > Date Then
        DoCmd.SelectObject acForm, "frmWeekView"
        MsgBox "Past Due Reminders"
    End If

Works fine on 2 of my other forms, in the On Load, that I base tblReminders on. The difference is the forms it works on are populated with the tblReminders date.

The other form (frmWeekView) doesn't display any date form it's recordsource.
Even when I add 'ReminderDate' to the form it doesn't work. It only has 7 subforms displaying reminders for each day of the week.
 
hi, have you tried the OnTimer event of form?

I have used once something like this:


I may be wrong but you could give it a try..

Now I'm confused.

First, lets get this less than greater than symbol right.
If I want to check to see if ReminderDate is earlier than today the less than greater than symbol should by pointing to ReminderDate?????

ie: ReminderDate <Date()



ie: 2<5 or 5>2.

No matter which way the symbol is pointing the message box pops up at the wrong time.

It pops up after the form opens which is fine but it doesn't pop up when a date IS less than today and does pop up when the ReminderDate is today or beyond.

I really wasn't expecting this. Why would it work ok on other forms but bot this one?????
 
Again, this form DOES NOT display any text fields form the table it is based on.

Then it should NOT be based on a table.

Much like arguing that your duck does not swim in your neighbors pool when your neighbor does not have a pool.

And yes, if you are going to look up a value to display a message box, you can at least be nice enough to your users to show what they clicked passed on the screen some place. Otherwise they will keep shutting your app down so they can see what it was that they clicked or entered passed when it started.
 

Users who are viewing this thread

Back
Top Bottom