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

Home Posts Topics Members FAQ

Creating a Macro to display a message box?

10 New Member
Hello:

I am trying to create a Macro in Access 2003 that will only display a message if a certain field is marked yes.

For example, when you open up a form, I need a message box to automatically pop up as "UNEMPLOYED INDIVIDUAL" if the unemployed field within the underlying table is marked "yes".

Thoughts - Is a macro the best wat to do this?

Thanks
Apr 3 '07 #1
4 8992
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hello:

I am trying to create a Macro in Access 2003 that will only display a message if a certain field is marked yes.

For example, when you open up a form, I need a message box to automatically pop up as "UNEMPLOYED INDIVIDUAL" if the unemployed field within the underlying table is marked "yes".

Thoughts - Is a macro the best wat to do this?

Thanks
In the form open event ...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open()
  2.  
  3.    If Me!Unemployed = "Yes" Then
  4.       Msgbox "UNEMPLOYED INDIVIDUAL", vbOkOnly
  5.    End If
  6.  
  7. End Sub
  8.  
Mary
Apr 6 '07 #2
eberry707
10 New Member
Thanks for the information. I am not too familiar with writing code, and there was an error when I attempted to add it.

Is there a way to set this up from an expression or a macro without having to actually "write code"?

Thanks

Eric
Apr 9 '07 #3
maxamis4
295 Recognized Expert Contributor
The anwser is yes. I don't recommend Macros at all. There excellent tools, but I would really recommend to do the code bit. As for the macro answer:

1. create a new macro
2. Click on the Condition button located in your tool bar.
3. Create the condition, such as forms!form1!text1 = true
4. Select Action msgbox and type in the message.
5. Goto the form, and under the event "On Open" select the macro you want to use.

Good luck
Apr 9 '07 #4
Geneman
17 New Member
You don't need a Macro.

Just put the suggested code in the OnCurrent part of the form


Private Sub Form_Current()
If Me.unemployed = "Yes" Then
MsgBox("Unemployed Individual", vbokonly)
Endif
End Sub

I think that syntax is correct.
Apr 10 '07 #5

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

Similar topics

4
561
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
2
11088
by: Mrs Howl | last post by:
I don't know if there's even a way to do what I want. I click on a button in an Access form, and it opens an instance of Excel, and opens a workbook and runs a macro that's in it. So far, fine,...
5
2226
by: lis0122 | last post by:
I'm a database marketing manager for a small non-profit. I created a query that prompts you for a company name and then pulls a list of all of our contacts in the database in that company. Our...
3
4213
by: m3ckon | last post by:
Hi there, I can succesfully create a word doc from my asp.net page, but I have 2 issues I need to resolve in order to use it in my app: 1) Creating a table: I seem unable to create a table,...
17
7050
by: sounak | last post by:
How could we get a macro name from a macro value such that in a header file #define a 100 #define b 200 now the source file will be such that the user gives 100 then the value is outputted as...
8
1890
by: nandakumar.raghu | last post by:
Hi, I am creating a #defined class like - #define BEGIN_TEST_MAP(testmapname) class testmapname\ {\ testmapname(){}\ testmapname(std::ofstream resultfile)\ {\ resultfile << "<Test name=\""...
3
1773
by: NickP | last post by:
Hi there, I am trying to do a reflection only load of an assembly, within a new appdomain, within a macro. i.e. create new app domain instantiate class run class
0
791
by: veer | last post by:
Hi i created two macro in ms-access and want the out put of both macro in one excel file. I execute first macro it display the output in excel but when i execute the second macro it delete the...
36
2509
by: sh.vipin | last post by:
how to make large macro paste the code as it is Problem Explanation '-- For example in the program below /* a.c - starts here */ #define DECL_VARS() \ unsigned int a0;\ unsigned int a1;\...
0
7205
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
7093
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...
1
7006
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
5592
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,...
1
5021
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...
0
4685
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
3175
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
1519
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 ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.