By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,821 Members | 1,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,821 IT Pros & Developers. It's quick & easy.

Input Box Fails to Cancel

P: n/a
I have been using a module for printing labels in Access 97, and
although it works fine, I would like to resolve a minor problem. The
module allows for setting the number of labels to print and/or to
skip; however, the Cancel command button does not function at all, nor
does clicking the X-close. Clicking either one is the same as clicking
the OK button. I have tried virtually everything, but to no avail.

Since the module creates and displays the input box, I assume that I
will need a piece of code to address the issue. A copy of the module
is posted below. Any assistance will be greatly 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
Share this Question
Share on Google+
3 Replies

P: n/a
Dalan wrote:
I have been using a module for printing labels in Access 97, and
although it works fine, I would like to resolve a minor problem. The
module allows for setting the number of labels to print and/or to
skip; however, the Cancel command button does not function at all, nor
does clicking the X-close. Clicking either one is the same as clicking
the OK button. I have tried virtually everything, but to no avail.

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

Option Compare Database
Option Explicit

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

Where/when are the functions called. You could do something like
Sub PrintIt()
LabelInitialize
LabelSetup
If msgbox("Do you want to print these labels at this time?",vbQUestion
+ vbYesNo) = vbYes then
'call the report
endif
End Sub


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

P: n/a
ot***@safe-mail.net (Dalan) wrote in
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 resolve a minor
problem. The module allows for setting the number of labels to
print and/or to skip; however, the Cancel command button does
not function at all, nor does clicking the X-close. Clicking
either one is the same as clicking the OK button. I have
tried virtually everything, but to no avail.
If you read the Access help file section for Inputbox, you will see
that pressing Cancel returns a zero-length string. You should
immediately test for that condition before testing for legal values,
then gracefully exit the procedure.

Bob Q

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

Nov 12 '05 #3

P: n/a
Thanks anyway Bob, but I gracefully found an alternate method to
achieve the same results by pressing the once famous DOS key in the
upper left corner. Dalan
Bob Quintal <bq******@generation.net> wrote in message news:<c3******************************@news.terane ws.com>...
ot***@safe-mail.net (Dalan) wrote in
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 resolve a minor
problem. The module allows for setting the number of labels to
print and/or to skip; however, the Cancel command button does
not function at all, nor does clicking the X-close. Clicking
either one is the same as clicking the OK button. I have
tried virtually everything, but to no avail.


If you read the Access help file section for Inputbox, you will see
that pressing Cancel returns a zero-length string. You should
immediately test for that condition before testing for legal values,
then gracefully exit the procedure.

Bob Q

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

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.