I've got a field that has some old data with text in it, but all forward
data will be a 3 digit number. But many of the numbers are still only 2
digits. I would like to force the leading zero in the entry of the field.
For example if the number 77 is entered into the field, 077 will display.
How do I format to force the leading zero? 5 20213
On Wed, 12 Jan 2005 21:15:57 -0500, OneDay wrote: I've got a field that has some old data with text in it, but all forward data will be a 3 digit number. But many of the numbers are still only 2 digits. I would like to force the leading zero in the entry of the field.
For example if the number 77 is entered into the field, 077 will display.
How do I format to force the leading zero?
If the field datatype is Number, set the format property of the
control to:
000
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
I think "Format" is what you're looking for here. The "Format" property
in TextBox if you trying to display from a Form, or you can reformat
the data using an update query with the "Format" Function. Ms-Access
help will give you examples of both.
HTH
Tom
OneDay wrote: I've got a field that has some old data with text in it, but all
forward data will be a 3 digit number. But many of the numbers are still
only 2 digits. I would like to force the leading zero in the entry of the
field. For example if the number 77 is entered into the field, 077 will
display. How do I format to force the leading zero?
OneDay wrote: I've got a field that has some old data with text in it, but all
forward data will be a 3 digit number. But many of the numbers are still
only 2 digits. I would like to force the leading zero in the entry of the
field. For example if the number 77 is entered into the field, 077 will
display. How do I format to force the leading zero?
If you mean displaying the data on a form, then something like this:
<AIRCODE>
Select Case Len(Me.txtField)
Case 1
Me.txtField = "00" & Me.txtField
Case 2
Me.txtField = "0" & Me.txtField
Case Else
' Do nothing, but always good practice to have a case Else!
End Select
If you mean that you want to update the data in your table, then:
UPDATE
tblMyTable
SET
tblMyTable.fldNumberField =
Switch
(
Len(tblMyTable.fldNumberField)=1,"00" &
tblMyTable.fldNumberField,
Len(tblMyTable.fldNumberField)=2,"0" & [fldNumberField,
Len(tblMyTable.fldNumberField)>2,tblMyTable.fldNum berField
);
</AIRCODE>
HTH
Edward
--
The reading group's reading group: http://www.bookgroup.org.uk
"fredg" <fg******@example.invalid> wrote in message
news:11******************************@40tude.net.. . On Wed, 12 Jan 2005 21:15:57 -0500, OneDay wrote:
I've got a field that has some old data with text in it, but all forward data will be a 3 digit number. But many of the numbers are still only 2 digits. I would like to force the leading zero in the entry of the
field. For example if the number 77 is entered into the field, 077 will
display. How do I format to force the leading zero?
If the field datatype is Number, set the format property of the control to: 000
Due to a relationship w/ an external sql table, the field in the table has
to be a text format.
But, because the SQL database has the leading zeros, in order to get the
records to match up, the table has to have the leading zeros too.
OneDay,
You can run an update query Like:
UPDATE OneDay SET OneDay.TxtNumFld = "0" & [TxtNumFld]
WHERE ((Len([TxtNumFld])="2"));
Tom
OneDay wrote: "fredg" <fg******@example.invalid> wrote in message news:11******************************@40tude.net.. . On Wed, 12 Jan 2005 21:15:57 -0500, OneDay wrote:
I've got a field that has some old data with text in it, but all
forward data will be a 3 digit number. But many of the numbers are still
only 2 digits. I would like to force the leading zero in the entry of
the field. For example if the number 77 is entered into the field, 077 will display. How do I format to force the leading zero? If the field datatype is Number, set the format property of the control to: 000
Due to a relationship w/ an external sql table, the field in the
table has to be a text format.
But, because the SQL database has the leading zeros, in order to get
the records to match up, the table has to have the leading zeros too. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: david |
last post by:
Hi,
I have an application as follows:
MySQL database Back-Eend linked to MS Access Front-End and ASP Web
Application.
I require users to enter Serial Numbers such as:
0105123567 (10...
|
by: samik_tanik |
last post by:
I need to export a datagrid to Excel.
I could did this. But, also need to keep the leading
zeros in the data.
How can I acheive this?
Any help would be appreciated.
--
Thanking you in...
|
by: mmmgood1 |
last post by:
Help, I'm linking an excel spreadsheet in access and I have datafields
with leading zeros (01021). When the file is linked in access, I get
a #num in the field with the leading zeros. The zeros...
|
by: Joshua Ammann |
last post by:
Hello,
I'm trying to export a query containing contact information, including a
field. Some zip codes have one or two leading zeros, for example,
San Juan, PR (00927) and Springfield, MA...
|
by: Clint Stowers |
last post by:
Using A2k
Exporting a query to a CSV file. The problem is any text fields (i.e. 000345)
lose any leading zeros.
Exporting to an excel file this problem does not exist.
Tried to create a...
|
by: Andrew |
last post by:
I run a fixed-width export based on a query, and the query looks like
this...
Clients.SSN, Clients.ClientID, ServiceEvents.SeviceDate,
CStr(Format(,"0000")) AS Servs, "28" AS SETTING,
FROM...
|
by: travellinman |
last post by:
Hi, I'm trying to combine the text in two original fields and paste them into another 3rd field on a form, but the problem is that there are leading zeros in both original fields, which access does...
|
by: LFM |
last post by:
I have a database setup that uses ODBC connections into SQL for read
only views to compare information from multiple sql databases in our
company. Most of the tables use the Employee ID as the...
|
by: Monty |
last post by:
Hi All,
I am having a problem with leading zeros being stripped from fields in a CSV
file when I bring them in using Jet/OleDB. In VB.Net/VS 2008, I am accessing
a CSV file like so:
sSQL =...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
| |