Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time error 2427 with label program

Status
Not open for further replies.

palgya

Technical User
Sep 3, 2002
34
0
0
US
Hello all,
I have a form that the user can update info on their clients. What they wanted to be able to do is print individual labels from this form, so I thru a checkbox on the form with a button that when clicked would print these labels if the box was checked. The other twist was that they could also choose how many labels to skip on a full sheet of labels so that they could reuse the sheet and how many of each label to print. Well when the user chooses zero labels to skip (starting from the 1st label on the sheet) I get "Run Time error 2427 you entered an expression that has no value. The expression may refer to an object that has no value, such as a form, a report, or a label control." When I debug, the first If Printcount line is highlighted but I can't figure out what is causing it. Hope this makes sense. Here's my code. Any suggestions would be great.

Static Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim intMyPrint As Integer
If PrintCount <= [SkipCounter] And [SkipControl] = &quot;Skip&quot; Then
Me.NextRecord = False
Me.PrintSection = False
intMyPrint = 0
Else
[SkipControl] = &quot;No&quot;
Me.PrintSection = True
Me.NextRecord = True
intMyPrint = intMyPrint + 1
If intMyPrint Mod [RepeatCounter] = 0 Then
Me.NextRecord = True
intMyPrint = 0
Else
Me.NextRecord = False
End If
End If

End Sub

Any help would be appreciated.
Thanks in Advance.
Paul
 
[SkipCounter] And [SkipControl] Are these controls on on the Report? Where are these values coming from? Or, are these controls on the Form? If they are on the form then you must refer to them in a different format.

Please explain.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Thanks for replying Bob,
[SkipCounter] And [SkipControl] are in the header of the report. [SkipCounter] is the control to tell how many to skip and [SkipControl] is the control to tell how many to print. Hope this explains.
Thanks again.
Paul
 
Bob, I'm sorry I was incorrect! SkipControl is an unbound textbox. SkipCounter is the control to tell how many to skip, and RepeatCounter is the control to tell how many to print. These are all in the header of the label report. The previous code is run on the On Print procedure of the Detail section of the report.

This procedure is run on the Report Header:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
[SkipControl] = &quot;Skip&quot;
Cancel = True
End Sub
 
I might also add that I have a macro that runs OnClose for the form that runs a query that clears all of the checkboxes.

UPDATE Individual SET Individual.PrintLabel = 0;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top