473,651 Members | 3,032 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 3428
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,568 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
3577
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 very early draft for a new "assert" syntax: This was inspired in Ruby's assert syntax. I'm not familiar with Ruby at all, so the chances are that this piece of code is broken, but I think the idea is very obvious. In Ruby, assert is simply a...
8
2293
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 fine I think) that will say "I'm sorry but the data you requested cannot be found" or something along those lines.... This code is on an archive page I have on my company's intranet....The end result is to show 3 records at a time pulled from an...
4
3268
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 section from the manual: 20.1.9.7 WHILE Statement
4
5121
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 code using tools-->references. The converted macro included the following statement: DoCmd.OutputTo acQuery, "qselLabelsBloodLog_output", "MicrosoftExcelBiff8(*.xls)", "S:\susan_cheree\lb041129.xls", True, "", 0
5
6101
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 sequentially. Is that a trick of the debugger or is a switch quicker by O(n).
10
2360
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 so, how do you do it? Thanx in adv.
19
8360
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 FOR UPDATE, it is fine and no error. I also tried Set objRs = objConn.Execute("SELECT * FROM EMP UPDATE OF EMPNO"), but it still couldn't help. any ideas? I tried to search in the web but couldn't find similar
0
1286
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 lets the extra semicolons confuse it. I believe the correct parse to be (especially because when I deleted the semicolon in question the procedure compiled): An unexpected token ";" was found following "turn str_out; end". Expected tokens may...
2
1936
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 they can adda story, I have a validation check on the title and main text fields, if the title is not set, then output an error message eg
11
8152
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 quotation marks "qryListCopiesToDelete" becomes the problem etc. When I remove all quotes from the above script the warnings go but the script fails to work! How do I get the DLookup to read the query? All queries were built in Query Design and...
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7299
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4144
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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 we have to send another system
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.