Hi there...
What is the VBA Code for inserting the string "none", in every blank textbox, in a report?
My system, generates a report from a query. eg: textbox1: FirstName ; textbox2: Middle Name; textbox3: LastName! Now, my report will display everyone's FirstName, MiddleName, LastName from the query. Incase someone does not have a middle-name, I need the word "None", to be displayed, on the the report? How do I go about doing this?
My attempt : If txtMidName.Valu e = " " Then txtMidName.Valu e = "None"
But clearly this didn't work
Please Help...
3 2786 FishVal 2,653
Recognized Expert Specialist
You could well help yourself debugging your code.
Hint for starters: - Put breakpoint on the mulfunctioning code line.
- Let code run.
- When execution stops (if ever) on the breakpoint check values returned by properties, variables, expression evaluation results etc involved.
- ??????
- PROFIT !!!
Kindest regards,
Fish.
Assuming that it is not a fault you are trying to trace - you just want to replace null fields (fields with no content at all) with the word "none" - you need to change the textboxes concerned in your report from being bound to an underlying field to being unbound, then set their control source to a call to the Nz function applied to your original bound field. This is not a VBA issue, and in any event you cannot change the contents of bound report controls using VBA code (although you can of course change the contents of unbound controls).
Say your textbox was called "TextBox2" and its control source is field "Middlename ". All you'd need to do is to change the controlsource property to
=Nz([Middlename], "(none)")
Note that it is rare for such a blank field to contain an empty string and not simply be null - there is a considerable difference. If it really does contain an empty string then Nz will not work (as the field is not null) in which case you can use an IIF statement instead:
=IIF([Middlename]="", "(none)", [Middlename])
Please also note that if the name of the textbox is the same as the bound field - which it will be if it was created by the report wizard - you must change it to a name that does not clash with the name of an existing field or an error will result.
-Stewart
Final thought from me on this one is that it is often a more general approach to put such computed fields into your report's source query (using the IIF or Nz approach as necessary), then use the computed field in your report instead of the potentially blank one. This has the benefit that you create the computed field just once and can use it wherever you use your query - in a form, a report or whatever.
The choice is yours...
-Stewart
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sam Sungshik Kong |
last post by:
Hello!
I use Python for ASP programming.
I found something weird.
Response.Write(Request("something"))
It draws "None" when there's no value for something.
Actually I expect "" instead of "None".
So I changed it like
|
by: Dan R Brown |
last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to
break up this form into several "tabbed" sections, I break up the form using <div>
tags. Each <div style="display:none"> can be displayed by setting the style attribute
to "display:", or hidden with "display:none". This gives the illusion that the person
filling out the form is switching from page to page...without the overhead of extra
hits on the server,...
|
by: Daniel Crespo |
last post by:
Is there a built-in method for transforming (1,None,"Hello!") to
1,None,"Hello!"?
Thanks
|
by: Sue |
last post by:
Help! I have an asp table with an embedded table. The asp
tablerow that contains this table has a static ID assigned
of "FilterRow2" (see snippets of code below). When I click
on the button to set the tablerow style property
to "None", the row (And embedded table) briefly disappear,
but then bounce right back into sight.
Any ideas on why it's doing this and how to make the
style.display = "None" stick?
|
by: z. f. |
last post by:
sorry about the previous post, by mistake not completed.
i have an asp.net page with the line
<%@ OutputCache Duration="30" VaryByParam="none" %>
but when i make requests to the page with different parameters, i get different result,
but i tries to check if i set the VaryByParam to none there should be the same output for different parameters, so why does it not work?
| |
by: Nathan Sokalski |
last post by:
I have several DropDownList controls on my page that use databinding.
However, I want to give users the option of selecting a choice such as "None
Selected" or something else that shows they did not make a selection.
However, if I attempt to add a ListItem to the Items collection when
databinding is used it is removed and replaced by the item in the
databinding source. Is there any simple way to add an extra ListItem, or do
I have to build...
|
by: Stan Brown |
last post by:
Posted by Pierre Blais in the current RISKS Digest:
http://catless.ncl.ac.uk/Risks/24.24.html#subj9
--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
|
by: spifster |
last post by:
Hello all,
I am building a collapsable tree using Javascript with DOM in IE. In
order to make collapsed cells disappear I have been hiding the text.
The cells collapse but still leave borders behind. I have set the
borderStyle to none and the black lines go away, but there is still
white space where the borders were. Following are my html files I am
using to test it.
----------------BEGIN HTML FILE----------------
|
by: Good Man |
last post by:
Hi there
I have quite a bit of experience with CSS but I am stumped by the
following:
http://www.electricphase.com/example/example1.php
(uses http://www.electricphase.com/example/test1.css)
http://www.electricphase.com/example/example2.php
(uses http://www.electricphase.com/example/test2.css)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 we have to send another system
| |