473,503 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

If statement to run Message Box

24 New Member
I'm trying to run a message box of a if statement. On one form under the load event I want to put this code:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![frmTracer]![Return Date]<Date()
with a "then" to open a message box if the date is not equal to current date. Help please. Thanks.
Jun 2 '16 #1
2 3420
Seth Schrock
2,965 Recognized Expert Specialist
If the OnLoad event is for the frmTracer form, then you can reference your control using the Me.[Return Date] syntax. I would strongly suggest removing the space in the name as it is much safer to not have it and having it can lead to problems.

I'm not exactly sure the logic that you are wanting in the IF statement, but the basic syntax for an IF statement is
Expand|Select|Wrap|Line Numbers
  1. If condition Then
  2.     'Do something here if the condition returns true
  3. Else
  4.     'Do something else here if the condition returns false
  5. End if
I think that you are wanting to check if Return Date is older than today's date, having a message box open if that is the case. If this is correct, then your condition would be
Expand|Select|Wrap|Line Numbers
  1. If Me.[Return Date] < Date Then
And you would put your code for the message box in the True side of the IF Statement.
Jun 3 '16 #2
NeoPa
32,557 Recognized Expert Moderator MVP
I suspect the situation here requires the alternative syntax for the If statement which is a single-line If.
Expand|Select|Wrap|Line Numbers
  1. If Me.ReturnDate < Date() Then Call MsgBox(...)
Jun 4 '16 #3

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

Similar topics

28
3540
by: Fábio Mendes | last post by:
I'm sorry if it's an replicate. Either my e-mail program is messing with things or the python-list sent my msg to /dev/null. I couldn't find anything related in previous PEP's, so here it goes a...
8
2289
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...
4
3256
by: James E Koehler | last post by:
I can't get the WHILE statement to work in MySQL. The version of MySQL that I am using is: Ver 12.16 Distrib 4.0.6-gamma, for Win95/Win98 (i32) running on Windows MX. Here is the relevant...
4
5107
by: Polly | last post by:
I had a macro that ran a parameter query and created and opened an Excel file with the system date as part of the file name, but I had to change the file name by hand. So I converted the macro to...
5
6095
by: Alvin Bruney | last post by:
Is a switch more efficient than an if statement? I observe thru the debugger that a switch statement jumps directly to its case handler where as an if statement examines all conditions...
10
2347
by: John Smith | last post by:
Can you do a Select Statement within a Select Statement? I want to build a query similar to queries built in Access which link to other queries but using only SQL Statements. Is it possible? If...
19
8340
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
0
1275
by: Bob Stearns | last post by:
Apparently db2 provides two forms of an error message, one more readable then the other. The readable one is apparently parsed from the other one. When db2 parses the error message shown below, it...
2
1928
by: keeps21 | last post by:
Hi I have a script that checks whether a user is logged in or not. If the user are not logged in they are directed to the login page. else the user is logged in. If the user is logged in...
11
8135
by: boliches64 | last post by:
Hi All I am getting the "Expected: End of Statement" message from my code: strSQL = strSQL & "DLookUp("", "qryListCopiesToDelete", "" >1)))" "" gets highlighted as an error! If I remove the...
0
7278
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
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.