SQL using vbTab or space (1 Viewer)

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
SQL using vbTab or space or ?

Lazy programmer, wants to put a tab in a SQL statement for a combo list box. I know how to use multiple columns. Is there a way to use Tabs in a SQL Statement?

Query builder:
Example 1:
MyList: [CityName] & " " & [STateAbbr]
outputs to Denver CO

Example 2:
MyList: [CityName] & vbTab & VbTab & [STateAbbr]
output to Denver CO

The vbTab does not work in example 2.
Is there a way to achieve the desited result?
 
Last edited:

SOS

Registered Lunatic
Local time
Yesterday, 23:02
Joined
Aug 27, 2008
Messages
3,517
vb constants can only be used in VBA. Use Chr(9) instead.
 

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
Office: [Branch] & Chr(9) & [Reg_Office] & Chr(9) & [State_abrv]

BIA Ft. Duchesne UT (squares between each field don't show.
Acht! the QueryBuilder shows a square between each field name :eek:

Looks like using this in the query builder or in a combo box query builder to be more exact, returns a square instead of a tab.
 

SOS

Registered Lunatic
Local time
Yesterday, 23:02
Joined
Aug 27, 2008
Messages
3,517
I've not had a problem before with it doing so. How are the squares showing? When you run the query? Can you provide a screenshot?
 

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
Access 2007
In the CBO QBE grid
it even has a small ? inside the square box

It is no big deal, I can just put each field in its own column and adjust the cbo to show all three columns.

Was just trying to put a couple of columns together. But, of course the text width of each name makes for a jagged seperator.

Googled MSACCESS SQL and the tab. Other people have reported this too.
Probably should mention that I am running on XP.
Maybe I will try this at home with Windows 7 to see if there is a difference?

Other reports of the Tab Squared - a new math term?
http://www.pcreview.co.uk/forums/thread-2035464.php
http://database.itags.org/ms-access-database/1740/
 

Attachments

  • Tab in Access 2008 Query Builder.JPG
    Tab in Access 2008 Query Builder.JPG
    9.5 KB · Views: 177
Last edited:

SOS

Registered Lunatic
Local time
Yesterday, 23:02
Joined
Aug 27, 2008
Messages
3,517
Hmmm, is there any kind of formatting on the fields at table level and/or on the combo box?
 

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
Wow, so it is just me? It is kind of interesting.

I created a fresh new query based on my States table.
That should discount any format settings on the combo box.

TabResult: [State] & Chr(9) & [State_abrv]
Same result with the square for the tab in just a new query's output.
The Property box for the new query has no new formatting.
Went to the underlying table in the _be
Other than Unicode Compression - Yes
It is just an autocounter field (not in the above query)
And the two fields - no formatting.
The display Views on SharePoint are set to Follow Database Settings


Nothing in the realm of formatting at all.
Nothing in the DB default settings either.
 

SOS

Registered Lunatic
Local time
Yesterday, 23:02
Joined
Aug 27, 2008
Messages
3,517
So are these combo boxes on SHAREPOINT or in Access? If in SharePoint I can see why they wouldn't work. But in Access...
 

vbaInet

AWF VIP
Local time
Today, 07:02
Joined
Jan 22, 2010
Messages
26,374
I used to get that square with a question mark thing too so I resorted to using spaces. Tabs don't work in textboxes or combo boxes, it may appear to work if set to Rich Text.
 

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
So are these combo boxes on SHAREPOINT or in Access? If in SharePoint I can see why they wouldn't work. But in Access...

100% Access - the property box for Sharepoint was the setting I was refering to.

Steps:
New Query
Pick your favorite table
Script -
MyQueryTest: [Field1] & chr(9) & [Field2]
show data in QBE Grid
result: the chr(9) shows up as a square (see attachment above)
And this result carries over to a CBO

It was worth a try.
 

SOS

Registered Lunatic
Local time
Yesterday, 23:02
Joined
Aug 27, 2008
Messages
3,517
Perhaps tab won't be the deal. You can simulate tabs by using space:

=[Field1] & Space(28-Len([Field1])) & [Field2] & Space(28-Len([Field2]))

I used 28 just as an arbitrary number but setting the number of spaces based on the length of the field should give you, generally, a look that looks like tabs.
 

Rx_

Nothing In Moderation
Local time
Today, 00:02
Joined
Oct 22, 2009
Messages
2,803
Combo: [State] & Space(20-Len([State])) & [State_Abrv]

Should have mentioned that I tried that too.
But, with the font's having proportonal width (i.e. WW is wider than ii)
the columns are very jagged.

That was what got me on the tab idea in the first place.
Had some crazy idea that the tab would be in fixed locations like the Word document or code editor.

That will teach me to "think outside the combo list box" :rolleyes:
 
Last edited:

Users who are viewing this thread

Top Bottom