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

Format combined fields?

Here's my issue. I'm using a calculated control to combine two fields on a
form & report. The two fields are RecordID (the autonumber primary key) and
a field named ProductCost. The idea is to create a "mysterious number" on
the forms & reports to hide the product cost so that customer looking at the
report wont know what it is. The catch, however, is that the salespeople
need to be able to quickly decipher the code. Ideally this would mean the
code would always begin with RecordID as a 4 digit number, the control would
add leading zeros to make the number 4 digits. It would then consist of the
price as a 6 digit number... 0000.00, again with leading zeros and always
two decimals. If possible, it would be even better if I could get the price
as a 6 digit number without a decimal but I realize that may be asking too
much. Any thoughts?
Mar 20 '07 #1
2 1860
Have you looked at the Format() function and thought of how to include
that in your results?

Mar 20 '07 #2
Aircode

Function CodeIt(RecordID as String, Price as Currency) As String

Dim StgRecordID as String, StgPrice as String
Dim PennyPrice as Long

StgRecordID = CStr(RecordID) ' Convert it to a string
RIDLoop:
If Len(StgRecordID) < 4 Then
StgRecordID = "0" & StgRecordID
Goto RIDLoop
End If

PennyPrice = CLng(Price * 100) ' * 100 to get rid of
decimals
StgPrice = CStr(PennyPrice)
PriceLoop:
...
...
work this out for yourself
End If
CodeIt = StgRecordID & StgPrice ' Join the bits together
End Function

HTH

Phil

"Jimmy" <do**@email.mewrote in message
news:lp******************@fe10.news.easynews.com.. .
Here's my issue. I'm using a calculated control to combine two fields on a
form & report. The two fields are RecordID (the autonumber primary key)
and a field named ProductCost. The idea is to create a "mysterious number"
on the forms & reports to hide the product cost so that customer looking
at the report wont know what it is. The catch, however, is that the
salespeople need to be able to quickly decipher the code. Ideally this
would mean the code would always begin with RecordID as a 4 digit number,
the control would add leading zeros to make the number 4 digits. It would
then consist of the price as a 6 digit number... 0000.00, again with
leading zeros and always two decimals. If possible, it would be even
better if I could get the price as a 6 digit number without a decimal but
I realize that may be asking too much. Any thoughts?

Mar 21 '07 #3

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

Similar topics

1
by: Riley DeWiley | last post by:
I have an application with two tables, A and B. Each has an autonumber unique ID field, plus other data. I have a junction table, AB, containing fields AID, BID, and Count (a number). AB has...
2
by: Akeel | last post by:
Hi I have the following code char splitter={','}; string fields=row.ToString().Split(splitter) string serviceDefintion="" // row.ToString().Split(splitter // conatins the followin...
9
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted...
6
by: Ted | last post by:
I used bcp to produce the apended format file. How can it be modified to recognize the quotes that surround the text fields and not insert the quotes along with the text? Invariably, the first...
0
by: jewelfire | last post by:
hey all I have the following: can someone show me how to format the following please =(Fields!SLAResolutionDate.Value)-(Fields!CreatedDate.Value) these are both date/time fields - I...
2
by: Nidhisharma | last post by:
Hi Folks, I need some help, I have Sales table,SalesRep1 table,productdetail table. Based on these three tables I made a query salesquery where I got the output as required. In Sales table there...
1
by: michaelw118 | last post by:
Hi, I hope someone can give me some solutions to these problems I faced. I imported some data to Excel. Then in Access, I table-linked to this file. I have two fields which in Excel is in...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
8
by: joemacbusiness | last post by:
Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial:...
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: 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...
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
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,...

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.