473,804 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Labels Dialog Box Enhancement

I have been using a module for printing labels in Access 97, and
although it works fine, I would like to add a small enhancement to it.
The module allows for setting the number of labels to print and/or to
skip; however, the Cancel command button does not function, nor does
clicking the X-close. Clicking either one is the same as clicking the
OK button.

Since the module creates and displays the dialog box, I will need a
piece of code to address the enhancement. A copy of the module is
posted below. Any assistance will be appreciated. Thanks, Dalan

Option Compare Database
Option Explicit

Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
Dim CopyCount&

Function LabelSetup()
LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))
If LabelBlanks& < 0 Then LabelBlanks& = 0
If LabelCopies& < 1 Then LabelCopies& = 1
End Function

Function LabelInitialize ()
BlankCount& = 0
CopyCount& = 0
End Function

Function LabelLayout(R As Report)
If BlankCount& < LabelBlanks& Then
R.NextRecord = False
R.PrintSection = False
BlankCount& = BlankCount& + 1
Else
If CopyCount& < (LabelCopies& - 1) Then
R.NextRecord = False
CopyCount& = CopyCount& + 1
Else
CopyCount& = 0
End If
End If
End Function
Nov 12 '05 #1
4 1795
> LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))
Instead of Input Boxes, use a custom form that you design. Place 3 textboxes
on it, one for each entry, with Ok and Cancel buttons, and set the set the
Min/Max buttons, control box, and close button to None/No in the form's
Properties box. The 3rd textbox will be a hidden textbox that holds a value
indicating whether the Ok or Cancel button was clicked. Open the form using
the acDialog window mode argument with the DoCmd.OpenForm command. This will
cause your code to pause until you close or hide the popup form. Have the
buttons set the value in the hidden textbox and hide the form
(Me.Visible=Fal se). In the line following the call to open the form, check
the value of the hidden textbox to see if Ok or Cancel was chosen. Depending
on the value of the hidden textboxes, get the values from the other 2
textboxes or react to the cancel. Remember to close the form when you close
the report.

--
Wayne Morgan
Microsoft Access MVP
"Dalan" <ot***@safe-mail.net> wrote in message
news:50******** *************** ***@posting.goo gle.com... I have been using a module for printing labels in Access 97, and
although it works fine, I would like to add a small enhancement to it.
The module allows for setting the number of labels to print and/or to
skip; however, the Cancel command button does not function, nor does
clicking the X-close. Clicking either one is the same as clicking the
OK button.

Since the module creates and displays the dialog box, I will need a
piece of code to address the enhancement. A copy of the module is
posted below. Any assistance will be appreciated. Thanks, Dalan

Option Compare Database
Option Explicit

Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
Dim CopyCount&

Function LabelSetup()
LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))
If LabelBlanks& < 0 Then LabelBlanks& = 0
If LabelCopies& < 1 Then LabelCopies& = 1
End Function

Function LabelInitialize ()
BlankCount& = 0
CopyCount& = 0
End Function

Function LabelLayout(R As Report)
If BlankCount& < LabelBlanks& Then
R.NextRecord = False
R.PrintSection = False
BlankCount& = BlankCount& + 1
Else
If CopyCount& < (LabelCopies& - 1) Then
R.NextRecord = False
CopyCount& = CopyCount& + 1
Else
CopyCount& = 0
End If
End If
End Function

Nov 12 '05 #2
"Wayne Morgan" <co************ *************** @hotmail.com> wrote in message news:<_X******* ************@ne wssvr32.news.pr odigy.com>...
LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))


Instead of Input Boxes, use a custom form that you design. Place 3 textboxes
on it, one for each entry, with Ok and Cancel buttons, and set the set the
Min/Max buttons, control box, and close button to None/No in the form's
Properties box. The 3rd textbox will be a hidden textbox that holds a value
indicating whether the Ok or Cancel button was clicked. Open the form using
the acDialog window mode argument with the DoCmd.OpenForm command. This will
cause your code to pause until you close or hide the popup form. Have the
buttons set the value in the hidden textbox and hide the form
(Me.Visible=Fal se). In the line following the call to open the form, check
the value of the hidden textbox to see if Ok or Cancel was chosen. Depending
on the value of the hidden textboxes, get the values from the other 2
textboxes or react to the cancel. Remember to close the form when you close
the report.

--
Wayne Morgan
Microsoft Access MVP
"Dalan" <ot***@safe-mail.net> wrote in message
news:50******** *************** ***@posting.goo gle.com...
I have been using a module for printing labels in Access 97, and
although it works fine, I would like to add a small enhancement to it.
The module allows for setting the number of labels to print and/or to
skip; however, the Cancel command button does not function, nor does
clicking the X-close. Clicking either one is the same as clicking the
OK button.

Since the module creates and displays the dialog box, I will need a
piece of code to address the enhancement. A copy of the module is
posted below. Any assistance will be appreciated. Thanks, Dalan

Option Compare Database
Option Explicit

Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
Dim CopyCount&

Function LabelSetup()
LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))
If LabelBlanks& < 0 Then LabelBlanks& = 0
If LabelCopies& < 1 Then LabelCopies& = 1
End Function

Function LabelInitialize ()
BlankCount& = 0
CopyCount& = 0
End Function

Function LabelLayout(R As Report)
If BlankCount& < LabelBlanks& Then
R.NextRecord = False
R.PrintSection = False
BlankCount& = BlankCount& + 1
Else
If CopyCount& < (LabelCopies& - 1) Then
R.NextRecord = False
CopyCount& = CopyCount& + 1
Else
CopyCount& = 0
End If
End If
End Function

Thanks for your suggestion Wayne, but I don't think that I want create
a form for this process. There are several different labels that are
available in the database and to include them all on a selection
form(s) is not an optimal consideration. Really, the current code
generated popup box works well and I would like to stay with it. Just
a small enhancement to the code is all I need. Any assistance or
further suggestions will be welcomed. Thanks, Dalan
Nov 12 '05 #3
In that case, the Input Box should return a zero length string ("") if
Cancel is clicked. I just tested to make sure, but I show that the close box
(x) acts as if Cancel was clicked.

If this isn't the action you're seeing, I would recommend a Repair and a
Compact of the database (Tools|Database Utilities). The compact and the
repair are separate items in Access 97. If that doesn't work, then I would
try a decompile on a COPY of the database to see what happens.

--
Wayne Morgan
MS Access MVP
"Dalan" <ot***@safe-mail.net> wrote in message
news:50******** *************** ***@posting.goo gle.com...
"Wayne Morgan" <co************ *************** @hotmail.com> wrote in message news:<_X******* ************@ne wssvr32.news.pr odigy.com>...

Thanks for your suggestion Wayne, but I don't think that I want create
a form for this process. There are several different labels that are
available in the database and to include them all on a selection
form(s) is not an optimal consideration. Really, the current code
generated popup box works well and I would like to stay with it. Just
a small enhancement to the code is all I need. Any assistance or
further suggestions will be welcomed. Thanks, Dalan

Nov 12 '05 #4
> Function LabelSetup()
LabelBlanks& = Val(InputBox$(" Enter Number of Blank Labels to Skip"))
LabelCopies& = Val(InputBox$(" Enter Number of Copies to Print"))
If LabelBlanks& < 0 Then LabelBlanks& = 0
If LabelCopies& < 1 Then LabelCopies& = 1
End Function


You aren't doing anything here to check for the "" if Cancel was clicked.
Val("") evaluates to zero. This will set up 0 LabelBlanks. It is also less
than one for LabelCopies, which you are automatically substituting one.

--
Wayne Morgan
MS Access MVP
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
401
by: Stelrad Doulton | last post by:
Hi, I have a requirement from my app to print a variable number of incrementing labels (actually barcodes but integer values will do for now). I have some suitable labels - 48 to a sheet and I am stuck as to the next step having never done any printing from an app before. Can the group make any suggestions? Cheers
1
1854
by: Laxmikant Rashinkar | last post by:
Hello, from inside a button handler, I am launching a dialog box that contains lables and text boxes. The dialog box is launched using dlg.Show(). In this situation the contents of the text boxes are visible but not the contents of the label. They become visible only after the button handler returns. If the dialog box is launched as dlg.ShowDialog() than everything is visible
104
7207
by: cody | last post by:
What about an enhancement of foreach loops which allows a syntax like that: foeach(int i in 1..10) { } // forward foeach(int i in 99..2) { } // backwards foeach(char c in 'a'..'z') { } // chars foeach(Color c in Red..Blue) { } // using enums It should work with all integral datatypes. Maybe we can step a bit further: foeach(int i in 1..10, 30..100) { } // from 1 to 10 and 30 to hundred
2
2355
by: SpotNet | last post by:
Hi Newsgroup, I have constructed highly customisable common dialog classes\objects. Decided to extend the Open\Save dialog options with the ability to change the text on all the controls. Mainly cause my boss wanted the Open File Dialog's OK button to read 'Import', for all intensive purposes. Open\Save dialogs where constructed purely from the Win32 API as you cannot inherit these classes from the framework. Problem I am recounting...
3
5471
by: Kidus Yared | last post by:
I am having a problem displaying Unicode characters on my Forms labels and buttons. After coding Button1.Text = unicode; where the unicode is a Unicode character or string (‘\u1234’ or “\u1234”) It seems to work the first time I set the button to the Unicode character. After a while, when saving my code, I get a pop-up window stating that I need to save the file as a Unicode else my changes will not be saved. Seance I do not want...
2
2452
by: Mel | last post by:
is it possible to change Confirm's button labels from OK/Cancel to say Yes/No ? thanks for your help
0
994
by: Allen Maki | last post by:
I wonder if you could help. The event handler code below, will allow the user to change the phone number and write it on a label of a message box. I want to replace the message box with a dialog box. Can anybody help me replace the message box below to a dialog box. In other words. I want to write the new phone number on a label (named "labe1")of a dialog box (named "dialog2),instead of writing the new phone number on the label of a...
0
916
by: Allen Maki | last post by:
I wonder if you could help. The event handler code below, will allow the user to change the phone number and write it on a label of a message box. I want to replace the message box with a dialog box. Can anybody help me replace the message box below to a dialog box. In other words. I want to write the new phone number on a label (named "labe1")of a dialog box (named "dialog2),instead of writing the new phone number on the label of a...
55
3173
by: aarklon | last post by:
Hi, why general integer expressions are not allowed in case labels in switch statements..????
0
9587
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
10588
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
10340
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
10324
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,...
1
7623
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
6857
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();...
1
4302
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
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.