473,413 Members | 1,989 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,413 software developers and data experts.

Fill field to the size of the field

I have a table with 2 fields (Cost) and (CostTxt).
I need to update (CostTxt) with the value of (Cost), where (Cost) is 123 and (CostTxt) becames 000000000000123.
The size of field (CostTxt) is 15.
Aug 19 '08 #1
3 1422
hyperpau
184 Expert 100+
I do not have access right now but I have done this in the past.

I amnot sure if it will work for you but try this.


Go to the design view of the table with the CostTxt and on the field CostTxt, apply a format and type 15 zero's ("000000000000000")

Then create an update query joining the two tables via the primary key and that primary key as the Criteria. Update the Costxt field with the value of Cost from the other table. It should automatically show the 123 as 000000000000123 in the CostTxt field.

However, this will only show it as such and not save it including the zeros.

If you would like to save it as such, then you might wanna do it through VBA on a form using the Format property. Costxt is a string I presume from its name.
Aug 19 '08 #2
puppydogbuddy
1,923 Expert 1GB
I have a table with 2 fields (Cost) and (CostTxt).
I need to update (CostTxt) with the value of (Cost), where (Cost) is 123 and (CostTxt) becames 000000000000123.
The size of field (CostTxt) is 15.
If these fields are on a bound form, then in the form:
try putting this in the format property of CostTxt: "000000000000000"

and this in the control source property of CostTxt: = Forms!YourForm!Cost
Aug 19 '08 #3
hjozinovic
167 100+
Expand|Select|Wrap|Line Numbers
  1. Private Sub Cost_AfterUpdate()
  2. If Len(Me!Cost) > 0 And Len(Me!Cost) < 16 Then
  3. Me!CostTxt = Left("000000000000000", 15 - Len(Me!Cost)) & Me!Cost
  4. Else
  5. MsgBox "Cost is not entered or is larger than 15 charachters"
  6. End If
  7. End Sub
Aug 19 '08 #4

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

Similar topics

8
by: netsurfer | last post by:
Hi: Have a question on making the date automatically filled in by what the user enters in by the date at the top. The date entered at the top would most likely be on a Wednesday then I need...
4
by: TS | last post by:
Hi, I'm using the ConvertCurrencyToEnglish module readily available on the internet to convert some currency figures to text. However, I want the code do one additional thing and I'm not sure how...
6
by: MROPARTNER | last post by:
I have a field in a form called "Date" I am looking to fill this text field with the current date. Is there a way to do this with ASP or an easier way? Thanks Bill
0
by: tshad | last post by:
MSN has a toolbar that has a Form Fill function that will try to fill form fields on forms when they come up. The problem is that it causes problems with some forms and functions. I found this...
2
by: k.bel | last post by:
The table I created is very easy: it consists of one field "Nomen" (datatype 'text' size 50) and 10 fields m1 to m10 datatype 'text' size 3. Now, having an array of some records with different...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
1
by: Steve Richter | last post by:
I have a form. In the Form is a MenuStrip and a FlowLayoutPanel. In the FlowLayoutPanel is a ListBox. The FlowLayoutPanel is set to DockStyle.Fill. The ListBox is set to AnchorStyles.Left |...
4
by: blg002 | last post by:
All I am trying to do is dynamically fill the "Your Price" field with a number that is the product of the value of "acres" "regularity" and 10. The annoying part is I had it working yesterday and...
11
by: Mike Harrison | last post by:
Hi, I have some simple HTML like this: <div id="container" style="width:100%;"> <input type="text" <input type="button" style="float:right;" value="Click here..."> </div> I want the button...
106
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.