Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35


    Quote Originally Posted by Welshgasman View Post
    I believe you do have access to paper width and height? I am sure I saw those properties when I was trying it our last night.

    Also confirmed here https://www.engram9.info/visual-basi...ollection.html

    I would have thought your labels would be associated with a defined page size, like Avery labels.?
    Well, according o that website it should have, but look at the image below:

    Click image for larger version. 

Name:	error.png 
Views:	14 
Size:	21.5 KB 
ID:	43232


    I get that error for the Height and Width supposed properties...
    About the labels, I honestly have no clue as to what name or brand they have. I just know they have 8 (width) x 4.7 (height) dimensions and honestly, in my opinion as a programmer (even though new to vba) that's all I need to know when it comes to setting the layout for what I need to print.
    I created a blank report, placed 2 textboxes there (both of them linked to the same view query field), one textbox has pure text and the other one is formatted for usage of barcodes (with the use of a .bas module that has the code to format the text into code128 barcodes) and this is pretty much it for the report.

    I can now print to the printer I choose at the cost of having no dimensions set for the report.
    The page you suggested does show that the printer object should have the height and width properties, but the image I shared sais otherwise...

    P.S.
    I just noticed the first paragraph of that article:
    Since it's part of the VB library, the Printer object isn't available to VBA applications. When you write a VBA (as opposed to VB) program, you simply make use of the host application's own built-in printing functionality

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    No, not the height and width of the report (though I expect the report should have those properties), the paper height and width in the printer properties.
    Normall labels are described as per page?, 2 across by 8 rows?, but still A4 or letter pahe size.?

    I would be trying it out on plain paper to see if the text lines up. That is how I generally test label layout, so as not to waste labels.

    Good luck anyway.

    Edit: report appears only to have a width property?

  3. #18
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    Quote Originally Posted by Welshgasman View Post
    No, not the height and width of the report (though I expect the report should have those properties), the paper height and width in the printer properties.
    Normall labels are described as per page?, 2 across by 8 rows?, but still A4 or letter pahe size.?

    I would be trying it out on plain paper to see if the text lines up. That is how I generally test label layout, so as not to waste labels.

    Good luck anyway.

    Edit: report appears only to have a width property?
    Ok my bad, the image I shared is misleading you, but if you look closely there's these 2 lines:

    Application.Printer.Height = 8
    Application.Printer.Width = 4.7

    These 2 lines of code have the compile error that's shown on the dialog box.

    About the labels, it's 1 label per page, the paper size is user defined, because it's a custom size that doesn't show up on the available pre-determined paper sizes.
    If you open the page setup of a printer, you'll see a combobox there for papersizes, correct? These are the pre-determined paper sizes are available for printers all over the world, at least that's how I see it.
    There's no paper size that has the 8 x 4.7 dimensions or even 4.7 x 8 dimensions, therefor, it's a custom paper size.

    At the moment, to test if the report has the right dimensions, I'm opening it in preview and see if any changes I sent through code actually have any effect and so far nothing. This is really annoying...

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Height and width is in twips, so the values need to be somewhat larger I would have thought.?

    Admittedly this is not something I have played with in the past (as you probably can tell )

    I would perhaps be trying out your page size in something like WordVBA and see what is in the printer properties after setting your custom sizes if no success in Access, at least you would then know what to set and with what values.?

    Out of ideas otherwise.

    Quote Originally Posted by Simbiose View Post
    Ok my bad, the image I shared is misleading you, but if you look closely there's these 2 lines:

    Application.Printer.Height = 8
    Application.Printer.Width = 4.7

    These 2 lines of code have the compile error that's shown on the dialog box.

    About the labels, it's 1 label per page, the paper size is user defined, because it's a custom size that doesn't show up on the available pre-determined paper sizes.
    If you open the page setup of a printer, you'll see a combobox there for papersizes, correct? These are the pre-determined paper sizes are available for printers all over the world, at least that's how I see it.
    There's no paper size that has the 8 x 4.7 dimensions or even 4.7 x 8 dimensions, therefor, it's a custom paper size.

    At the moment, to test if the report has the right dimensions, I'm opening it in preview and see if any changes I sent through code actually have any effect and so far nothing. This is really annoying...

  5. #20
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    Well.. I'm out of ideas, I've tried countless approaches to get the dimensions for the papersize and anything I try is just ignored/has no effect.
    If anyone ever manages to find the solution I'll be here... waiting...

  6. #21
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    In my Access, whilst I cannot choose a non standard page size, I can select a particular printer. Then in the printer properties I can define a User Defined page size.? Then when I come back to Access those sizes are reflected in the report?
    Do you have that ability.?

  7. #22
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    Hey Welshgasman,
    Yes, I can define the printer properties, such as dimensions, paper trays, paper sizes, etc.
    The thing is, this "application" is to be used by warehouse supervisors, that have little to no knowledge regarding the use of printers and we don't like to give access to more content than needed, such as giving said users the ability to change settings of printers. Such a thing is a bad practice as people here tend to have a bad habit of doing things they shouldn't.
    So, my goal is to just give these users the ability to choose the printer they wish to print to and how many labels they wish to print and that's it.

    I've still tried tinkering around with the code from the link I provided before by changing the functions to public and after a couple of tests I did see the DCPrinter returning the current dimensions of the paper size of the printer and changing that papersize to 8cm x 4,7cm, but when I print it just comes out as if I'm printing a default papersize of the printer...

    I think I'm just gonna try via VB.NET at least there I know I can change the setting of a printer more easilly...

  8. #23
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    No, my understanding is that report is set to custom size, and then they just select the printer.?
    The page dimensions are saved with the report.?
    TBH I have never seen a page size as 8 * 4.7 cm?, but only perhaps an A4 page with labels that size perhaps 2 wide and 8 deep.?

    Good luck anyway.

  9. #24
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Have a look at this thread. Not same problem, but maybe gives insight on generally controlling odd printer requirements.

    https://www.accessforums.net/showthr...t=extra+labels

  10. #25
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    Hello everyone,
    @davegri
    Thank you for the suggestion, been there done that, it's like vba or access or whatever is just disregards the settings I set for the printer, even though on run-time, when debugging I see the values being set...
    Well, I just migrated everything to vb.net and everything's working like a charm there. No headaches
    It's a shame the same can't be done on vba as simple as it is on vb.net.
    Thanks everyone for their time.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Printing many docs for a chosen period.
    By Perfac in forum Reports
    Replies: 3
    Last Post: 01-17-2018, 09:53 AM
  2. Replies: 5
    Last Post: 01-27-2014, 07:50 AM
  3. Replies: 1
    Last Post: 03-08-2013, 03:05 PM
  4. Setting Printer when Printing Report
    By russ0670 in forum Reports
    Replies: 3
    Last Post: 05-12-2010, 09:45 AM
  5. Printing to an intermec printer from access
    By dkalsow in forum Programming
    Replies: 3
    Last Post: 12-16-2009, 06:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums