Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Question Unanswered: MS Access Print Record Color Change

    I have added a button on a form to enable printing a single record from an Access Data Base. I would like to know how to change the background color of the form for that record to white so that I don't use a lot of printer ink. The forms name is Meds. I tried using Meds.background = vbRed, and get the message, Object Required. Help would be appreciated. RickMc

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    forms!meds.background ?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Aug 2002
    Location
    Melbourne, Australia
    Posts
    111
    RickMc,

    You print Reports not Forms. You need to create a report based on the same source as the form. After you do that, if you don't know how to print the current record then post back, or sent a sample of your db and I will show you how.
    Regards,



    John A

  4. #4
    Join Date
    Nov 2009
    Posts
    223
    I have the same problem.

    I know it is good practice to produce a Report instead of printing a Form.

    But, is there any way to print a Form with a white background if the screen background is grey??

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why?
    as others have said a report is a report, targetted at printing out on paper or storing electronically on PDF or snapshot
    a form is a form for displaying or manipulating data

    within the access world you would be better off creating a report and calling that report from a button on the relevant form.

    the only other approach would be to change the design of the form removing the colour scheme, then printing the form, then rresettign the scheme. you have to bear in mind that Access is targetted as a RAD (rapid applciation development tool) NOT a complete language such as .NET, Java or whatever. its basic design goes back to the 90's long long before CSS was introduced (in fact long before t'web was introduced).

    you may be able to use something similar to CSS in new versions of Access but I don't know. I don't intend to find out as I have a design paradigm that works. create a report for a printing task
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Nov 2009
    Posts
    223
    yes, i hear what you say.

    but i have about 50 basic Forms, which look satisfactory when printed (apart from the high cost of ink due to the grey background).

    why should i waste valuable time designing and creating 50 new Reports which will look exactly like my Forms (apart from the grey background)?

    and then, if i add a new field to a Form ,then i also need to adjust the relelvant Report also.

    any anyway, it shouldn't bee too difficult just to change the background colour, should it?

  7. #7
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Nothing prevents you from changing the background color of a form but you have to do it for every section:
    Code:
    Private Function ChangeBackgroundColor(ByVal NewColor As Long)
    
        Dim i As Integer
        
        On Error Resume Next
        For i = 0 To 4
            If Me.SECTION(i).Visible = True Then Me.SECTION(i).BackColor = NewColor
        Next i
        
    End Function
    The line 'On Error Resume Next' or another error trapping mechanism is necessary because, as far as I know, there is no mean to determine how many sections are present on a given form, and there is no Sections collection that you could enumerate (For Each...).
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •