473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Ignore blank columns and line space in query return?

18 New Member
Memos Query - sort of looks like:

Expr1: MainTable.ID (the link between tables)
Expr2: Table2.Memo
Expr3: Table3.Memo
Expr4: Table4.Memo
Expr5. [Table2.Memo] + [Table3.Memo] + [Table4.Memo]

I've tried writing Expr5 as IIf, Is Not Null, IsNull etc and nothing works to remove blank space in Expr5 column

Example of how it looks now if Expr2 is blank:
Top of the textbox
----------------------------------------------
|
|
|
|
|
|
|
| Beginning of text from Expr3.Memo.
| Blank space above this ^^^^
| How do I remove this?
|
|
|
|


My network admin will not enable VBA/Macros so I am having to build everything based on queries and IIF statements, and everything else that isn’t very efficient.

This gives me a combination of all memos in Expr5. But sometimes, Table2, 3 or 4 is blank. In this case if Table2.Memo is blank, the memo text from Expr5 starts in the middle of the column instead of at the top. It even looks like a blank column until I expand it vertically to find the text in the middle. It also visually appears this way in the [Forms]![MemoQuery] ![Expr5.Textbox] and any reports.

How can I visually remove this space from empty Expr1, 2, or 3 tables so that it appears at the top of any and all text boxes?

Thank you in advance!
Apr 5 '16 #1
6 1454
PhilOfWalton
1,430 Recognized Expert Top Contributor
Try
Expr5. Trim([Table2.Memo]) & Trim([Table3.Memo]) & Trim([Table4.Memo])

Always use &, not + for concatenating strings.
The Trim function should remove any spaces at the beginning and end of any strings. In fact you may have removed the space between the fields in which case try
Expand|Select|Wrap|Line Numbers
  1. Expr5 = Trim([Table2.Memo]) & " " & Trim([Table3.Memo]) & " " & Trim([Table4.Memo])
Phil
Apr 5 '16 #2
jdusn1978
18 New Member
Phil,

Thank you for the reply; however, both ways you suggested is still giving me the blank space any time the proceeding column expression is blank.

The memos are created via an IIf query. If I change the IIf query to Else False instead of Else being Null, all those empty lines are turned to 0's.

Does this mean something? It seems like it is not TRIMMING because it's actually empty, it just appears to be.

Not sure if that makes sense, really new at this and sysadmin through a wrench in my database dreams when the said they would not allow VBA Functions and Macros etc.
Apr 5 '16 #3
PhilOfWalton
1,430 Recognized Expert Top Contributor
OK, I'm a bit stumped. It is possible that you have a load of unprintable characters in your memos, probably linefeeds, but we need to know what we have.
The only way I can see to investigate is to write a little VBA on your local machine (Its only temporary to investigate further)
Expand|Select|Wrap|Line Numbers
  1. Public Function ShowTableField() As String
  2.  
  3.     Dim MyDb As Database
  4.     Dim Rs As Recordset
  5.  
  6.     Set MyDb = CurrentDb
  7.     Set Rs = MyDb.OpenRecordset("SELECT Table2.* FROM Table2;")
  8.  
  9.     With Rs
  10.         'Do Until .EOF
  11.             Debug.Print !Memo
  12.             '.MoveNext
  13.         'Loop
  14.         .Close
  15.         Set Rs = Nothing
  16.     End With
  17.  
  18. End Function
  19.  
You mat want to remove the comment lines to find the record you want.
If in the Immediate Window you type
?ShowTableField()

This will dump the contents of table2 memo to the immediate window.
Now copy everything (including what appears to be blank space) into a hex editor program like Hexplorer and let's see what we've got

Phil
Apr 5 '16 #4
NeoPa
32,556 Recognized Expert Moderator MVP
I suspect there may be carriage returns or line feeds in your data. White space <> empty space.

This would mean the information you're giving us is inaccurate (albeit unintentionally so). I suspect this is where Phil is coming from also.

It may be easier for you to create a file with a Table2.Memo value in it which represents one of the lines where Expr2 takes up verticle space but shows no characters.

We're probably both going to find investigating the data in hex a bit easier than you might.
Apr 6 '16 #5
jdusn1978
18 New Member
Phil/NeopPa,

NeoPA, I think you’re right. You saying carriage returns made me think, the original data I’m trying to pull in is created using concatenating strings from other sources that include Chr(13) & Chr(10).

I’m really out of my depth there and probably wrote those poorly as well. And, I’m not leaving info out on purpose, just not sure how to correctly speak the lingo. BTW, this project is on a system that cannot talk to this system that connects to the internet.

Those, probably poorly written, concatenating strings look like:
= [Expr1] + Chr(13) & Chr(10) + [Expr2] + Chr(13) & Chr(10)+

This is where the Expr2: Table2, 3 or 4.Memo comes from.

Then, what I was asking about in my original question pulls this from each query and its respective table into one query so that as I click through the record the data is displayed in a textbox on a subform. I am running queries on top of queries to get around the fact that I am not allowed to run action code on the net.

I was under the impression that + Chr(13) & Chr(10) + would make the carriage return optional, as in only used if there’s something in the preceding [Expr]. Maybe it should an - AND IIf(IsNull[Expr1,Null,[Expr1] & Chr(13) & Chr(10))?

I will start a new thread question: How to write and expression that leaves out carriage returns if they are not needed?
Apr 6 '16 #6
NeoPa
32,556 Recognized Expert Moderator MVP
jdusn1978:
And, I’m not leaving info out on purpose, just not sure how to correctly speak the lingo.
I don't imagine you are. Now I've seen even more of your posting style I'm pretty confident of that in fact.

You've handled the forum guidelines perfectly. Posting a separate question is exactly the way to go.

It's also an interesting question and it's already in my queue of items to look at.
Apr 7 '16 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Marcus | last post by:
Is there a way to hide columns in a query? If so, where would I find some sample code on this topic? If this can be done, is it better to hide columns in a query, or simply build a second query...
8
by: Krul | last post by:
I like to have a blank entry at top of the combobox list, so the user is able to clear the combobox. Right now, the form displays a empty entry on load, but after chosen a value once, it is not...
4
by: Rocketman | last post by:
How can i program this function in C#
6
khalidbaloch
by: khalidbaloch | last post by:
i want to show on page the messege that say there is currently no item when a mysql query return no record instead of blank page .. i hope this is not a big issue and will be resolved in first reply...
1
by: Phil | last post by:
Is it possible to swap rows and columns in select query output so that each record's data is displayed in a column? I want to collect data each day and display it in a query with each day's date...
2
by: ielamrani | last post by:
Hi, this is very strange. I am trying to add 2 columns in a query but it does not come out right. Column1 Column2 Column3 $15.00 $30.00 $15.00$30.00 Column3 should equal $45.00. ...
2
by: Will | last post by:
Hi, I need to handle blank values in a query calculation. I have 636 records at the moment but when I sum over these records the blank fields are not returned. I have looked around here and on...
2
by: kkshansid | last post by:
same query return rows in mysql but not on php page while($rs = mysql_fetch_array($sql2)) { $town=$rs; $q="select * from institute where address like '%".$town."%'";//this query //echo $town;...
2
by: mahmoodn | last post by:
Somewhere in my html code, I have wrote this <div class="container"> <div class="content"> <table width="962" border="0"> <tr> <td width="649" height="324"><h2>my name</h2> ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.