473,385 Members | 1,712 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.

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 4689
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.google.co m...
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.google.c om>...
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
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
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 ...
3
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...
4
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...
1
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...
4
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...
1
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...
10
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
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.