473,657 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining 2 fields in a query problems

Hey,

I have some problems combining 2 fields in a query.

For example: the first field is "1050-04" and the second field is
"02".
However, when i try to combine these two the zero in the second field
disappears. So it reads "1050-042" but i want it to be "1050-0402".
The number 02 increases, so when it reaches 10+ it should be like
"1050-0410".

I can't seem to get it to work.
I hope someone can help me. Thanks in advance.
Nov 12 '05 #1
2 4705
In the Field line of the query design window you would use something like

CombinedField:[Table1].[Field1] & [Table1].[Field2]

What is the data type of the fields, text or number? Is the leading zero
really there on the second field or is it being displayed there by a Format
command? If it is by a Format command you can redo that by

CombinedField:[Table1].[Field1] & Format([Table1].[Field2], "00")

--
Wayne Morgan
Microsoft Access MVP
"Kristian" <kr************ **@hotmail.com> wrote in message
news:45******** *************** **@posting.goog le.com...
Hey,

I have some problems combining 2 fields in a query.

For example: the first field is "1050-04" and the second field is
"02".
However, when i try to combine these two the zero in the second field
disappears. So it reads "1050-042" but i want it to be "1050-0402".
The number 02 increases, so when it reaches 10+ it should be like
"1050-0410".

I can't seem to get it to work.
I hope someone can help me. Thanks in advance.

Nov 12 '05 #2
kr************* *@hotmail.com (Kristian) wrote in message news:<45******* *************** ***@posting.goo gle.com>...
Hey,

I have some problems combining 2 fields in a query.

For example: the first field is "1050-04" and the second field is
"02".
However, when i try to combine these two the zero in the second field
disappears. So it reads "1050-042" but i want it to be "1050-0402".
The number 02 increases, so when it reaches 10+ it should be like
"1050-0410".

I can't seem to get it to work.
I hope someone can help me. Thanks in advance.


If the second field is of type Number, then you'll have to use the
Format$ function to force it to show leading zeroes.
Nov 12 '05 #3

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

Similar topics

4
1571
by: badbetty | last post by:
MS Access 97 query: Given 2 simple tables Person PersonRef (text) (primary key) Surname (text) e.g PersonRef Surname
5
2103
by: M.Stanley | last post by:
Hi, I'm attempting to create a query that will combine 2 columns of numbers into one. The followng comes from 1 table with 4 fields (A,B,C,D) A B RESULT 700 000 700000 700 001 700001 700 002 700002 ..
3
10639
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems that are hard to find. The main problem I am having right now is that I have a report that is sorted by one of these lookup fields and it only displays the record's ID number. When I add the source table to the query it makes several records...
4
3125
by: Omey Samaroo | last post by:
Dear Access Gurus, Can anyone provide me with some much needed assistance. I would like to combine the contents of 3 text fields into one field. Can someone provide some code or a method to do so. Please and Thanks Omey
1
2002
by: PATGMorris | last post by:
I've got a Union Query that pulls data from two different tables for chemistry and micro testing. The tables containing very similar data but for reasons not necessary here, cannot be put into one table (differing types of results mainly) However, both have date entry fields for varying time stations from an initial, 2 weeks, 1 month, 2 months through to 24 months. I've written a Union Query that pulls the dates into a sort of ...
4
3489
by: justin tyme | last post by:
Hello Experts! I would like to combine (which may not be the correct technical term) two text fields from the same table in a query. Specifically, text field A and text field B are both lists of names. My goal is to have one long list of all the names, not A next to B like one gets when you use the & operator. The eventual goal is to be able to print labels of all the individuals. I have no problem creating a label-Report from the Query....
1
1887
by: Macbane | last post by:
Hi, I really hope you can help. I have a databse which records interventions in patients drug therapy. Each record in the main table contains 3 fields to capture the 3 main drug names involved in the intervention and they are called PrimDrug, SecondaryDrug1, SecondaryDrug2. The drug names are selected from another table called Drug. What I want to do is to have a graph illustrate the top ten drugs involved. While it is easy to do...
10
10600
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
3
2834
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one dataset to data in a second dataset, using a common key. I will first describe the problem in words and then I will show my code, which has most of the solution done already. I have built an ASP.NET that queries an Index Server and returns a...
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.