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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print a Label at a given postion 1

Status
Not open for further replies.

JamesBBB

Technical User
Nov 2, 2005
74
GB
Hi,

I have a problem that I cannot solve, not for the want of trying.

Basically I need to print out an individual mailing label and rather than use the top left hand label only off of each sheet, I like to be able to use a label at any position on the sheet.

The Labels are A4 and have 7 labels each side.

I have created a report with all the address details in a single text box, label size and in the top left hand corner of the report.

I then created a form that looks like a page of labels and I would click on the label I wanted to print, the onlcik event would set a couple of Public integers “PTOP” and “PLEFT” ready to pass through to the report text box parameters left and top.

I then open the report with the label and try to pass through the left and top positions of the text box containing the label information using the “on open” event.

The trouble I have is, if I set the TOP and LEFT position of the text box manually, the text box moves to the right location on the report and works perfectly, however I cannot get it to work by using code to move the text box to the right position.

I hope you can understand what I’m saying here. It would be much easier with picture.

Any help would be very gratefully received.

James
 
Hi
I found that this worked:
Code:
Private Sub Report_Open(Cancel As Integer)
Me.Text0.Left = 4875 'twips
Me.Text0.Top = 4800  'twips
End Sub
But I needed to have the page set to a size greater that the position I wanted to use.

I also found that this worked:
1. Set up a form (frmForm) with an option group (fraFrame) containing 14 checkboxes, a text box (txtAddress) and a command button to open the report.
2. Set up a report with 14 textboxes labelled txt1 to txt14.
3. Add this code to the report:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  Me("txt" & Forms!frmForm.fraFrame) = Forms!frmForm.txtAddress
End Sub
 
Hi Remou,

Many thanks for that information.

I actually made a very cowboy effort of making 14 seperate reports with the label at each point on the form required.(Hangs heda in shame)

However, I will certainly try your code examples, very much appreciated.

Many thanks

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top