473,379 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Character that displays as a blank

675 512MB
Access 2003 strips trailing blanks from text in tables. It also strips trailing blanks for control properties on forms.
I have a tab control where I want to pad shorter captions with blanks so all tabs are equal width. I want to center these captions, so I need to include trailing blanks that are not stripped by Access.
What character (hex value) will show on forms as a blank, not a null, but will not be removed by Access?
Jun 28 '10 #1
8 3996
ADezii
8,834 Expert 8TB
@OldBirdman
Now sure if this will work, but try using the Space() Function. The following code will pad any String will Spaces on the Back End to a Constant Length of 32:
Expand|Select|Wrap|Line Numbers
  1. Const conWIDTH As Byte = 32
  2. Dim strCaption As String
  3.  
  4. strCaption = "Caption 1"
  5.  
  6. strCaption = strCaption & Space(32 - Len(strCaption))
P.S. - Chr$(32) or &H20 will also generate a Space Character
Jun 28 '10 #2
jimatqsi
1,271 Expert 1GB
I think you have stated the problem wrong. If you are centering the captions, then adding blanks to the end will only take the caption off of center alignment and it will tilt to the left.

The problem is to set the .width property of the tabs. You can do that programmatically or with the GUI at design time. There is a property on the tab control called TabFixedWidth. It is normally zero, which lets the tabs vary in width to fit the provided text. Change that setting to be long enough for your widest tab label.

Jim

Jim
Jun 28 '10 #3
jimatqsi
1,271 Expert 1GB
Another helpful thing to remember is that you can specify fixed length strings.
dim A as string * 20 makes a fixed 20 character string. You could also try using that to your advantage here, something like this
Expand|Select|Wrap|Line Numbers
  1. dim strA10 as string * 10
  2. strA10 = tab1.caption
  3. tab1.caption = strA10
  4. strA10 = tab2.caption
  5. tab2.caption= strA10
  6. strA10 = tab3.caption
  7. tab3.caption= strA10
  8.  
Jim
Jun 28 '10 #4
OldBirdman
675 512MB
Space() is a variation of String(). Neither works for this. Whether I enter "XXX ", "XXX" & Space(5), "XXX" & String(5, 32), or "XXX" & " ", the results are the same, when entered into a table.
For assigning to .Caption in design view of a form, the text becomes literal, and my tab contains "XXX & Space(5)"
Assigning into .Caption at runtime doesn't work either. Access strips the trailing blanks.

I'm tracking use of a building, 4 floors, 6 rooms/floor.
I wanted the tab control to be:
Expand|Select|Wrap|Line Numbers
  1.    1      2      3      4      5      6
  2.   101    102    103    104    105    106
  3.   201    202    203    204    205    206
  4.   301    302    303    304    305    306
  5.      Office           Storage Room
I thought if I could enter " 2 " for room #2, I could make the tabs show as a matrix, and fill the row space. But " 2 " becomes " 2" for all these suggestions.

I can live with Fixed Width Tabs. I was just hoping for either fixed widths per each tab, or using blanks to force the width to larger than Access default.

Note: This site strips blanks, so my example for room #2 with 3 leading and 3 trailing blanks is stripped to one each.
Jun 28 '10 #5
NeoPa
32,556 Expert Mod 16PB
I expect it depends on your CodePage OB, but with some preliminary tests I found 95 (8F) & 160 (A0) at least showed no character. I haven't got a tab control to test it on, but they may be worth checking. Otherwise Jim's suggestion seems as if it may take you where you want to go I would think. Good luck anyway.

PS. I managed a test on a label category. 95 was no good, but 160 seemed to work. Be advised though, I doubt it's very portable/reliable.
Jul 5 '10 #6
OldBirdman
675 512MB
Thank you for the replies.
On my machines, the character 95 (8F) is an 'a' with an accent over it, an extended alphabet character. It shows on a tab as this character, not as a blank.

The character 160 (A0) is the underscore. It also shows in both tab controls and label controls.

I have 2 solutions to my initial question:
1) Start and end each tab caption with a period(.). With a bold font, this gives the control a riveted, or hi-tech appearance.
2) Use Jim's suggestion as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim i As Integer
  3. ...
  4.     'Initialize tab captions - Cannot be done at design time: Access strips trailing blanks
  5.     For i = 0 To 23
  6.         If i < 6 Then
  7.             tabUnits.Pages(i).Caption = Space(7) & Int(i / 6) * 100 + 1 + i Mod 6 & Space(7)
  8.         Else
  9.             tabUnits.Pages(i).Caption = Space(5) & Int(i / 6) * 100 + 1 + i Mod 6 & Space(5)
  10.         End If
  11.     Next i
  12.     tabUnits.Pages(24).Caption = "                 Office                "
  13.     tabUnits.Pages(25).Caption = "               Storage Room                 "
  14. ...
  15. End Sub
Note: All lengths and number of spaces are determined by 'trial-and-error'. The width of the tab control, the font size, the font weight, and the font name all determine how much space the actual characters use.
In my example, I cannot use 'Tab Fixed Width' because of the 2 un-numbered rooms. Proportional spacing with FontName=Tahoma makes the 2 different space() lengths necessary for room numbers less than 100.
Jul 6 '10 #7
jimatqsi
1,271 Expert 1GB
Steven Lebans created a sample mdb to automatically resize a textbox (or other control) to fit the text that needed to be in it. The exact description from within the routine reads:
"Returns Control Width & Height needed to display the contents of the Control passed to this function."

Maybe that has the key to your solution. It uses a lot of API calls and takes the control's font property into consideration when making the calculation. You can find it at
http://www.lebans.com/autosize_textbox.htm

You could come up with something using that at runtime to calculate the needed size after all captions are known, and then automatically set the tab width property.

I hope this helps.

Jim
Jul 6 '10 #8
OldBirdman
675 512MB
Thanks Jim.
This is a form design problem. I wanted tabs that were larger than Access created by default. I also wanted the tabs to form a logical matrix, room 203 in the same column as 103 & 303.
My original post shows what I want. I changed the font size to increase the individual tab's width, but beyond FontSize=14, the text was overpowering.
I tried fixed-width tabs, but the 2 non-numbered rooms defeated that approach.
I padded the numbers with leading blanks, which works well, but the numbers are not centered on the tabs. So I tried to pad to the right, but Access strips the trailing blanks in Design View.
Solution is to assign the tab captions at run-time. Works quite well, thank you. It just takes trial-and-error to balance the number of leading/trailing blanks, the font size, the tab width, and the tabcontrol width.
I'm happy with this.
Jul 6 '10 #9

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

Similar topics

2
by: Scott Vesey | last post by:
In VB, when using the form: MessageBox.Show("some text") The result is a small blank dialog with a blank button. If I specify the full set of parameters for the MessageBox.Show using the...
3
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't...
2
by: zdrakec | last post by:
Hello all: I have the Crystal Report viewer imbedded on a .NET form, and it works very well... except, on the target machine, when I set the ReportSource property of the viewer (to a...
3
by: JebBushell | last post by:
The page never gets to Page_Load and displays blank. Setting the trace flag makes no difference. View Source reveals: <BODY> <ASP_SMARTNAV_RDIR...
4
by: monomaniac21 | last post by:
hi im outputting text from a db and where a £ sign has been entered a ? character appears instead which i cant seem to get rid of with a simple str_replace. is their a way to get rid of it? and...
0
by: ftech | last post by:
I am saving PDF files in SQL Server 2005 as an image and retrieve them back by their document ids. I use the following code: byte buffer = (byte)dtDoc.Rows; if(buffer != null) { ...
0
by: Fresno Bob | last post by:
When I start a website project in Visual Studio Pro 2008 with debugging I get an about:blank page in IE7. I have read people having the same problem in 2005 and applying SP 1 fixed it. Are there...
2
by: Joseph J. Kesselman | last post by:
Gabe wrote: You can do exactly that, exactly as you've shown it: <nameJohn Smith</name> But... Now you aren't talking about XML -- you're talking about the behavior of the tool you're...
10
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For...
11
by: Mathanan | last post by:
<?php include("connect.php"); include("dbaselevel.php"); session_start(); $username = $_POST; $password = $_POST;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
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...

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.