By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Message using IIF statement

P: 49
Hi
I have a form that has a sub form. Want to add a text box that would didplay a message depending on different cirteria. The sub form list items to be followed up on, so if there was an item that was past due and not complete I want to diplay a message that there are past due items, same if there was an item that was due in the next 30 days.
I have tried creating a text feild with a control coure using dcount but had not luck. Can anyone give some other ideas?
Thanks
Aug 20 '08 #1
Share this Question
Share on Google+
1 Reply


hyperpau
Expert 100+
P: 184
The best solution I could think of as of the moment is to add a Form_Current() event to your form and use a function to compute the age of the balance. Dcount is not necessary for this only counts the number of records.
A simple calculation would do.

Lets say:
I have a form with the fields:
dteBillDate
dteDueDate
stMessage

Now of course the dteBillDate and dteDueDate should already have records depending on how you set up the Due date field to populate.
Then I have one record already where
dteBillDate = 08/01/08
dteDueDate = 08/30/08
stMessage = No entries. (This can even be an unbound control)

On the current event I will write this codes.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current ()
  2. Dim intAge as Integer
  3.  
  4. intAge = DateDiff("d", "dteBillDate", "dteDueDate")
  5.  
  6. Select Case intAge
  7.      Case  > 30
  8.                stMessage = "No Items past due yet."
  9.     Case <  30
  10.               stMessage = "Items already past due for " & intAge & " days."
  11.     Case <  60
  12.               stMessage = "Items already past due for more than 60 days."
  13. End Select
  14. End Sub


Hi
I have a form that has a sub form. Want to add a text box that would didplay a message depending on different cirteria. The sub form list items to be followed up on, so if there was an item that was past due and not complete I want to diplay a message that there are past due items, same if there was an item that was due in the next 30 days.
I have tried creating a text feild with a control coure using dcount but had not luck. Can anyone give some other ideas?
Thanks
Aug 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.