473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Message using IIF statement

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
1 1499
hyperpau
184 Expert 100+
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

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

Similar topics

8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
2
by: Robert Stearns | last post by:
I don't understand the reference "2" in the following message. There is only a primary key constraint on the named table. It is generated by default and Im not inserting a value for it. SQL0803N...
4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
9
by: Bob Stearns | last post by:
When trying an alter I am getting: DB2 SQL error: SQLCODE: -20054, SQLSTATE: 55019, SQLERRMC: IS3.SERVICE_OBS;22 Message: The table "IS3.SERVICE_OBS" is in an invalid state for the operation. ...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
1
by: Jeremy Ames | last post by:
I have a datagrid that updates the table using a stored procedure. The stored procedure is confirmed to complete correctly, yet the sql data adapter is returning an error that my application is...
8
by: Andrew Robinson | last post by:
Are these two equivalent? Is one better than the other? I tend to go with #1 but started wondering.... Thanks, 1: using (SqlConnection cn = new SqlConnection(DataConnection)) using...
8
by: g_man | last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
15
by: tshad | last post by:
Do I still need to close an object in a finally statement after a catch if it is part of a using statement? For example: FileStream fs = null; try { using (FileInfo fInfo = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.