473,405 Members | 2,294 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,405 software developers and data experts.

Right justify entry for varchar data type : (

Hello everyone, I'm using Access 2000 and SQL 8.0

This maybe easy but I can't figure it out. I have a linked access
table to a SQL server table. I use this table on a Grid on an Access
form. There is a field on the grid for the Equipment Number the field
is called Equipment (I know original).

The data type for this field is varchar with a length of 10 and the
data is rigth justified in the table
on the SQL Server.

The grid is only for doing edits (no new records can be added). When
the user changes the Equipment number on the grid I need that data to
be right justify with spaces on the left. Now you can manually enter
spaces in the textbox first and then enter the number but that's not
realistic to ask the user to do that. The way it is now if the user
just enters the number when the change hits the Equipment table the
number is Left justified which is an invalid Equipment Number.
Anyway to have spaces padded to the left with code. I tried this on
the before update event but Access did not like it Me.Equipment =
Right(" " & me.Equipment, 10). I got an error message saying
that the code was preventing me from updating the record.

Any help appreciated-----thanks

Nov 2 '07 #1
2 4591
Be aware that adding spaces to your data as you describe will change the
value of that data (or force you to use ltrim(rtrim()) all over the
place. I would advise against adding spaces to the actual data. If
someone needs to view this data as right justified during data entry
then you need to create a data entry form where the text in the
textboxes is right justified. A datasheet view should not be used for
data entry. That is like entering data directly into a table which
defeats the value of having a frontend application where you can trap
errors control data entry...

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 2 '07 #2
On 02 Nov 2007 20:49:29 GMT, Rich P <rp*****@aol.comwrote:

I agree with everything you say, but couldn't:
ltrim(rtrim())
be replaced with:
trim$()

-Tom.

>Be aware that adding spaces to your data as you describe will change the
value of that data (or force you to use ltrim(rtrim()) all over the
place. I would advise against adding spaces to the actual data. If
someone needs to view this data as right justified during data entry
then you need to create a data entry form where the text in the
textboxes is right justified. A datasheet view should not be used for
data entry. That is like entering data directly into a table which
defeats the value of having a frontend application where you can trap
errors control data entry...

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bill | last post by:
In an effort to improve the speed of queries against my main table, I'll be indexing a column whose data type is varchar(50). Would I be better off (better performance) if I changed the column's...
6
by: Leonard | last post by:
How do I right justify input data in a textbox? I have some textboxes that are used to input numbers, and I would like to right justify them.
10
by: Techie | last post by:
what's the difference of the two data types?
6
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down...
9
by: sql guy123 | last post by:
I normally use MS ACCESS vs MS SQL,, which has a left() and right() function. I need to use MS SQL for this project but I am not familiar with it. I have read a few books, but can not figure out...
3
by: deepaks85 | last post by:
Dear Sir, I have setup a SQL database with PHP. Whenever I am trying to insert the data into my database it gives me error : 'Duplicate entry for key 2'. Please help me sir. I am sending you...
11
by: Pablito | last post by:
Hi at all into a page I wrote <style> body {margin-left:10%;margin-right:10%;text-align:justify;} </style> reading the page with FireFox the margin left is 10% but the right is 0% Why? How can...
1
by: RGow | last post by:
Hi, I'd like to know whether there is a way to alter the data type of a VARCHAR FOR BIT DATA column to be simply a VARCHAR column? I executed an ALTER TABLE statement, similar to, ALTER TABLE...
0
by: Brenda | last post by:
We are on DB2, AIX fixpak 14 This error happens when running PeopleSoft PeopleCode Application Engine process. I have checked other posts out here and it seems like others who have reported...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
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
isladogs
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...

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.