473,803 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Message Box on Print

14 New Member
I have a label that needs to print out when a part comes in, but I want a message box to pop up to ask how many copies of the label do they want to print. This is my code so far. Where the Docmd.Print is, I have 2 for the copies, but I want a message box that the user will enter how many they want.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command32_Click()
  2. 'Open report in Preview mode
  3.     DoCmd.OpenReport "Labels Part Labels Dymo", acViewPreview
  4. 'Print out specified number of report copies
  5.     DoCmd.PrintOut , , , , 2
  6. End Sub
Sep 16 '08 #1
4 2280
Laharl
849 Recognized Expert Contributor
This is in the wrong place, perhaps you wanted the Visual Basic forum?
Sep 16 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Moved to the Visual Basic forum. The Feedback forum is not for technical questions. Please use the most relevant forum for your question. Also remember to enclose your code in code tags.

Moderator.
Sep 16 '08 #3
lee123
556 Contributor
is this an Access Database you have or visual basic, because a "DoCmd" is in MS Access i have never seen it done in visual basic 6

lee123
Sep 16 '08 #4
kiseitai2
93 New Member
Please specify what kind of VB are you using (MS Office or VB IDE).

Choices I would implement:
1) Create your custom dialog box, then create a PUBLIC variable (Public copyNumber as Integer), and then pass the number of copies to the main window through the global variable (the one you set to Public) after you showed the Dialog form and got some input from the user.
2) Set a variable and use the InputBox("","") function to get a value for the variable.

Supposing you don't have VB 6 (IDE) and Office follows most of VB 5/6:

Expand|Select|Wrap|Line Numbers
  1. Public copyNumber as Integer
  2. Private Sub Command32_Click()
  3. 'Open report in Preview mode
  4.     DoCmd.OpenReport "Labels Part Labels Dymo", acViewPreview
  5. 'Ask for # of copies
  6. frmAsk.show()
  7. 'frmAsk is the custom dialog form created for option 1.
  8. 'If you can't use .show(), try .visible = true
  9. 'Print out specified number of report copies
  10. 'Pass the number of copies
  11.     DoCmd.PrintOut , , , , copyNumber
  12. End sub
Supposing you have VB IDE:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command32_Click()
  2. 'Open report in Preview mode
  3.     DoCmd.OpenReport "Labels Part Labels Dymo", acViewPreview
  4. 'Ask for # of copies
  5. Dim i as Integer
  6. 'The function InputBox is in VB 6 but I don't know if it is in VB for Office (try it anyways)
  7. i = InputBox("Replace with Prompt", "Replace with Title for the Dialog Box")
  8. 'Print out specified number of report copies
  9. 'Pass the number of copies
  10.     DoCmd.PrintOut , , , , i
  11. End sub
I really hope ou got your answer.
Sep 17 '08 #5

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

Similar topics

8
1661
by: Nathan Pinno | last post by:
Hi all, I need help figuring out how to fix my code. I'm using Python 2.2.3, and it keeps telling me invalid syntax in the if name == "Nathan" line. Here is the code if you need it. #This program asks for a password, then asks for the user's name after the correct password has been supplied. The computers response will vary, # depending on the name inputted. print "Program Author: Nathan Pinno"
5
3884
by: Bernard | last post by:
Hi, I have a problem with a CGI script (Perl) on a Win2000 server. The script is for sending E-cards and was written by Jason Maloney: http://www.aestheticsurgerycenter.com/scripts/postcard/postcard1.shtml You can choose from some cards, add your own text and send it to a friend. This friend get a mail which tell him/her that he/she has a mail and have to click a link. So far everything works just fine. But when the recipient clicks...
3
15285
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I have a perl script that runs on my webserver, which is supposed to login to the gameserver and download the log. The problem is that when it gets to the part where it needs to download the file, it aborts. The gameserver FTP requires I use port 24...
4
2220
by: Chris | last post by:
Hi, I found this code that can solve a problem I have. It sends print direct to printer. Imports System Imports System.Text Imports System.Runtime.InteropServices <StructLayout(LayoutKind.Sequential)> _ Public Structure DOCINFO<MarshalAs(UnmanagedType.LPWStr)>
16
9380
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
2
4448
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist then skip this file and move onto the next file (line). If file is there then move to a sirectory. Here is the code I have (Feel free to make corrections as needed. If possible make changes in red)
9
1211
by: Benny | last post by:
The methods within an interface is not virtual. How do I go about doing the following: class BaseClass : IComparable { int CompareTo(Object o) {...} }; class DerivedClass : BasedClass {
7
2860
by: Gasten | last post by:
Hello. The last weeks I've been coding a roguelike (you know, like nethack) in python using the nCurses library. Some week ago I ran into a problem: When I made the object for messagebar-output, I found a bug that I can't figure out (believe me; I've tried everything and asked for help several times on the IRC-channel). The updateMsg() and iMsg() takes a list of message-lines as argument (or process a string to a list), and it'll output...
12
3020
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed the instructions and couldnt get the correct results. heres the code stuff... temperature=input("what is the temperature of the spam?") if temperature>50: print "the salad is properly cooked." else:
10
2118
by: CuTe_Engineer | last post by:
hii, i have cs assignment i tried to solve it but i still have many errors , plzz help mee :"< it`s not cheating becuz i`ve tried & wrote the prog. i just wanna you to show me my mistakes #these are the operations + = , - = , * = , 1/ = only if 0 not in .
0
9699
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
9562
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
10542
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...
0
10309
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...
0
10068
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
9119
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
7600
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
6840
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();...
3
2968
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.