473,770 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need help with Message box if statements..

1 New Member
I need help with the following code.
I am trying to extract two reports at the same time, but I want the viewer to see the report first before exporting it. The reason is in case the report is null. There are two reports, one for 2006 and one for 2007.

Problem is when I tried making a Msgbox if statement, it does not work correctly. I want the user to say "yes or no" to extract report and then continue from there.

I can't get either working. Any help will be apperciated.

If there is a simpler way where I tried to export both reports to a folder but does NOT export null reports (reports with no data) that would even be better.




If (Plan_Year) = "Both Plan Years" Then

stDocName = "Plan Type Checks1"
DoCmd.OpenQuery stDocName, acNormal, acEdit

If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then

stDocName = "Plan Type Checks1"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2006 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks1"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks1", acSpreadsheetTy peExcel9, stFileName, False

stDocName = "Plan Type Checks2"
DoCmd.OpenQuery stDocName, acNormal, acEdit

If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then

stDocName = "Plan Type Checks2"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2007 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks2"

DoCmd.OutputTo acOutputQuery, "Plan Type Checks2", acSpreadsheetTy peExcel9, stFileName, False

If MsgBox("CDI FSA Check Printed Reports Exported to X:\Clients\C\CD I\2007\Outsourc ing\FSA. Go to CDI FSA Report folder?", vbYesNo) = vbYes Then
FollowHyperlink "X:\Clients\C\C DI\2007\Outsour cing\FSA "

End If
Aug 21 '07 #1
2 2308
SWcisel
2 New Member
I need help with the following code.
I am trying to extract two reports at the same time, but I want the viewer to see the report first before exporting it. The reason is in case the report is null. There are two reports, one for 2006 and one for 2007.

Problem is when I tried making a Msgbox if statement, it does not work correctly. I want the user to say "yes or no" to extract report and then continue from there.

I can't get either working. Any help will be apperciated.

If there is a simpler way where I tried to export both reports to a folder but does NOT export null reports (reports with no data) that would even be better.




If (Plan_Year) = "Both Plan Years" Then

stDocName = "Plan Type Checks1"
DoCmd.OpenQuery stDocName, acNormal, acEdit

If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then

stDocName = "Plan Type Checks1"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2006 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks1"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks1", acSpreadsheetTy peExcel9, stFileName, False

stDocName = "Plan Type Checks2"
DoCmd.OpenQuery stDocName, acNormal, acEdit

If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then

stDocName = "Plan Type Checks2"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2007 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks2"

DoCmd.OutputTo acOutputQuery, "Plan Type Checks2", acSpreadsheetTy peExcel9, stFileName, False

If MsgBox("CDI FSA Check Printed Reports Exported to X:\Clients\C\CD I\2007\Outsourc ing\FSA. Go to CDI FSA Report folder?", vbYesNo) = vbYes Then
FollowHyperlink "X:\Clients\C\C DI\2007\Outsour cing\FSA "

End If
Did you try assigning the return value to a variable, then running the If statement?
Aug 21 '07 #2
kadghar
1,295 Recognized Expert Top Contributor
You're not closing the IF statements.
Try closing each IF, or change the IFs, other than the first one with ELSEIF
Aug 21 '07 #3

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

Similar topics

15
7395
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
4
7305
by: Crystal | last post by:
Ok, I know this sounds weird, but it's really bugging me. I have a few list boxes on my form (basic pick a month, year, state stuff) and you can only choose one value. I need to be able to run a script to pick out those boxes and request the value and then response.write the value to a URL that I am creating. The script actually sends an email to me that contains a link to the form that the user filled in and populates the form with...
6
1995
by: Matt Creely | last post by:
I have a very strange database with a very strange problem. Consider 4 tables: Table1: ---------------- Table1ID INT PK Table2ID INT FK Table3ID INT FK OrderNo VARCHAR(50)
7
1787
by: kackson | last post by:
Hi. I created a simple view with the following statements: CREATE VIEW dbo.VIEW1 AS SELECT dbo.VIEW_ALL.ID, dbo.VIEW_ALL.Code, Another.dbo.OTHER_VIEW.Label as SpecialCode FROM dbo.VIEW_ALL LEFT OUTER JOIN
22
2762
by: nobody | last post by:
hello everybody, is there a way of creating an array with help of a function that would accept the name of this array as a parameter and then create global Array type variable of that name? so that for example the following code would work as well in browsers as under Windows Scripting Host: str = "tableA";
55
3949
by: Alex | last post by:
Hello people, The following is not a troll but a serious request. I found myself in a position where I have to present a Pro/Con list to management and architects in our company with regard to developing new products (specifically - desktop products) in C#/.NET instead of the usual C++/COM that we do. Since I am not an experienced .NET developer by any definition, I don't have a good grip on the "Pro" part. The argument that I hear...
22
2292
by: Zeng | last post by:
Hi, I'm running ClrProfiler for the first time to profile my web app, and it keeps getting stuck at this msg box: "Waiting for Asp.net to start common language runtime - this is the time to load your test page." even after I launched my app and aspnet_wp.exe is running. Do you know what I need to do to fix it? I also found some old post, a person mentioned that I need to make sure I need to run my aspnet with system account instead. ...
1
2154
by: Tom Rahav | last post by:
Hello all! I develop application in Visual Basic .NET and ORACLE database. My question is how do I "send" script file to the database using visual basic .net. Other words, is there any way to send to the database a script file to run, as done by: "@FullPath\FileName" in SQL PLUS ? If not, then I need your help with something else: I tried to send to the database the script file's content, in order to run the commands in it (create...
9
2107
by: colin.mcnulty | last post by:
Hi, I'm a SQL Server DBA, but I guess that won't buy me any friends round here huh? ;-) I've been asked to look at the SQL that's being executed on a DB2 database from a web app, specifically when the web site does XYZ, what SQL does it run on the DB2 database? Unfortunately everyone who knew about how it works has left and I've never even seen a DB2 database before today! So, I appear to be looking at an IBM DB2 Universal Database...
9
1990
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an ArrayList? I have tried looping through the logfile using regex, if statements and flags to find the start and end of each message but I do not see a good time in this process to create a new instance of my Message object. While messing around with...
0
9618
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
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
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
9906
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
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.