Hi,
Instead of repeating the code in multiple reports, i wanted to create a module that will be called for all types of reports that i have created.
The code that I plan to execute is a Public function under Module1, and being called from "on format" event procedure of my detail reports. The code below is typical for the rest of my 10 reports. - Option Compare Database
-
-
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
-
F14.BackStyle = 1
-
-
If Text35 = "A" Then
-
F14.BackColor = RGB(0, 128, 128)
-
F14.ForeColor = vbWhite
-
-
-
ElseIf Text35 = "B" Then
-
F14.BackColor = RGB(255, 102, 0)
-
F14.ForeColor = vbBlack
-
-
ElseIf Text35 = "C" Then
-
F14.BackColor = RGB(204, 204, 255)
-
F14.ForeColor = vbBlack
-
-
-
Else
-
F14.BackColor = vbWhite
-
F14.ForeColor = vbBlack
-
-
-
End If
-
-
End Sub
Goal should be like this.. - Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
-
Call Module1
-
-
End Sub
Please help thank you.
1 929 NeoPa 32,556
Expert Mod 16PB
As a first thing I'd say check out Require Variable Declaration. Running without that set, as you are, is a recipe for disaster. AJLJ:
Goal should be like this.
Not really. That makes little sense. However, it could be like : - Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
Call ColourX(objVar:=F14, strVar:=Me.Text35.Value)
-
End Sub
This is complicated by the lack of any explanation of what F14 and Text55 are and where they come from. The example code below will certainly be less useful due to the lack of that information. - Option Compare Database
-
Option Explicit
-
-
Public Sub ColourX(objVar As Object, strVar As String)
-
With objVar
-
.BackStyle = 1 'Normal
-
-
Select Case strVar
-
Case "A"
-
.BackColor = RGB(0, 128, 128)
-
.ForeColor = vbWhite
-
Case "B"
-
.BackColor = RGB(255, 102, 0)
-
.ForeColor = vbBlack
-
Case "C"
-
.BackColor = RGB(204, 205, 255)
-
.ForeColor = vbBlack
-
Case Else
-
.BackColor = vbWhite
-
.ForeColor = vbBlack
-
End Select
-
End With
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chris B. |
last post by:
I'm getting some strange results in an asp.net web application that has
recently gone live.
In the header of almost all the pages, the full name of the currently logged
in user is displayed. On...
|
by: Jason |
last post by:
I have an ASP.NET application in which I would like to call my button click
event (imgSubmitSearch_Click) on the page load if certain criteria are met.
Is this possible?
What is the correct...
|
by: Robert |
last post by:
Every thing worked fine until all of a sudden, I get the following error
whenever I try to do anything on one of my forms that calls an Event
Procedure. I get the error as soon as the form opens...
|
by: peter shaw |
last post by:
Hi,
I got an error message after I created a new event procedure for a grid
control. But I can write a new procedure without any problem.
The error is...
|
by: MLH |
last post by:
None of my applications' many forms have actions
defined for the Form_Close event. I would lke to
automate the addition of the following procedure
to all my forms in their Close Event property...
|
by: vbisjustforme |
last post by:
Hello,
I am working on a windows dll and this is my problem:
'api
Public Declare Function myFunction Lib "Functionmine.dll" (byval ProgieName as String) as Boolean
'entry point in module...
|
by: AMD_GAMER |
last post by:
Hi,
I am trying to print address labels. I have a form which asks for
the user to input the first name, middle initial, and last name. On
the button click to print the label, I have an event...
|
by: gnawoncents |
last post by:
I have a dynamic report (created from VBA coding) and I want to set the OnClose event procedure to make another form visible when the report closes. I cannot access the events in the report itself...
|
by: Knut Ole |
last post by:
i get the following error: "The expression On Mouse Move you entered as the event property setting produced the following error: A problem occurred while Access was communicating with the OLE server...
|
by: RojK |
last post by:
Hi,
I have a userform which has some command buttons and multiple listboxes in VBA.
I have a class module which handles events on the form, and a code in the form's initialization section which...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |