Hi
i have an report with fields Student Name ,Roll No ,subI subII,SubIII,subIV In which i to sum all sub. so i add unbound txtbox and in controlsource add expression =(subI)+(subII)+(SubII)+(subIV). It work perfectly when all sub having marks but from 4 sub only 3 are compulsory and one optional so when optional sub not having marks sum is not take place and when i add zero to optional sub sum take place but i want add dashes (--) in that sub than zero. How can i do this
6 1112
Let's assume Sub4 is optional. You can create two columns in a query. In first column give it a name e.g. Sub4a : Apply "if" formula something like : IIf([Sub4]>0,[Sub4],0) and do calculation part based on this column of the query.
Create another column in the query e.g. Sub4b : Apply "if" formula again something like : IIf([Sub4]>0,[Sub4],"-") and display this field in report/form.
So my point is : for display purpose you can use 'Sub4b' and for calculation purpose use 'Sub4a'
Try
expression =Nz(subI)+Nz(subII)+Nz(SubIII)+Nz(subIV)
In other words, if one of the Sub is blank, treat it as .
Phil
Phil, this will definitely resolve calculation part, however, they also want that the value should appear either the number or (--) dashes, instead of zeros (0).
Thanks
Not too difficult.
On your report, create 4 labels identical in size to the Sub... box
The label caption is "--" your dashes. Aligned Right and the same border as your Sub.. Text box.
Put those labels directly over their corresponding text boxes.
Now we need a bit of code to either show the text box or the label. -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
-
If Nz(SubI) = 0 Then
-
SubIDash.Visible = True
-
SubI.Visible = False
-
Else
-
SubIDash.Visible = False
-
SubI.Visible = True
-
End If
-
-
If Nz(SubII) = 0 Then
-
SubIIDash.Visible = True
-
SubII.Visible = False
-
Else
-
SubIIDash.Visible = False
-
SubII.Visible = True
-
End If
-
-
If Nz(SubIII) = 0 Then
-
SubIIIDash.Visible = True
-
SubIII.Visible = False
-
Else
-
SubIIIDash.Visible = False
-
SubIII.Visible = True
-
End If
-
-
If Nz(SubIV) = 0 Then
-
SubIVDash.Visible = True
-
SubIV.Visible = False
-
Else
-
SubIVDash.Visible = False
-
SubIV.Visible = True
-
End If
-
-
End Sub
-
-
Phil
jforbes 1,107
Recognized Expert Top Contributor
Another option is to perform the substitution in the ControlSource of your unbound TextBox. You can change your ControlSource to something like this: - =IIf(NZ([subI],0)=0 OR NZ([subII],0)=0 OR NZ([SubII],0)=0 OR NZ([subIV],0)=0 ,"-",[subI]+[subII]+[SubII]+[subIV])
Thanks to all you i will try your solution and i hope it help me.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: MGFoster |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that
worked in ACC97 doesn't work in ACC2K2.
Report setup:
ACC97 ...
|
by: Simon Matthews |
last post by:
Hope someone can help an Access beginner!
I've just started keeping my surgical logbook on access and it's a
simple flat-file affair. I have created several queries that will
list cases...
|
by: BFord |
last post by:
Using Acc2000, only the report itself not printing.
The following have been tested, with no problem:
1) the print drivers are fine.
2) printed the query (source of the report)
3) printed...
|
by: Steve Patrick |
last post by:
Hi All
You guys are my last hope, despite spending money on books and hours reading
them I still can not achieve the results I need.
I have designed a database in Access 2000 based on 1 table,...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
| |
by: AdrianE |
last post by:
I have a database where a record has a start date and an end date and is linked to an employee.
Ho do I create a report that will show each employee and gaps between the employees next record...
|
by: darktiger |
last post by:
Okay I have a report that uses a query to pull multiple info from different tables. Some of the information is Total # of applicants which is to be pulled from different values such as "Hispanic,...
|
by: DeanL |
last post by:
Hi guys,
I'm in need of a little help with a report I'm setting up on Access
2000. The report shows data depending on entries on a form that has 7
fields (Min and Max Cost, Fiscal Year, Min and...
|
by: Dave |
last post by:
On my form I have combo boxes. These combo boxes, after updating
them, populate respective listboxes that are located below the combo
boxes on the same form. I am trying to use a "generate...
|
by: Studiotyphoon |
last post by:
Hi,
I have report which I need to print 3 times, but would like to have
the following headings
Customer Copy - Print 1
Accounts Copy - Print 2
File Copy -Print 3
I created a macro to...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |