473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1774
> 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=False). 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.google.c om... 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*******************@newssvr32.news.prodigy .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=False). 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.google.c om...
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.google.c om...
"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<_X*******************@newssvr32.news.prodigy .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
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...
1
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...
104
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...
2
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. ...
3
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...
2
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
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...
0
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...
55
by: aarklon | last post by:
Hi, why general integer expressions are not allowed in case labels in switch statements..????
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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...
0
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,...

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.