473,609 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert Numeric Field to text in Query

I have a mess on my hands. I have a whole set of queries and reports
(almost a whole app, really) that has "location" as a text field.
Sometimes it's a number and a few times it's text (001, 002, and ADV,
TRN, MER). I now have to link on "LocationCo de" (text)and "StoreNum"
(numeric - from the other application - all numeric).

I want the query to put the values for 001 from the numeric side with
the values for 001 from the text side, but I keep getting "type
mismatch in expression".

Is there a way to tell Access to use the Text as Numeric or vice-versa
in either of the underlying queries so I can get what I need?

I need the Text fields - ADV, TRN, MER (and their associated Payroll
numbers)from the table/query that is text LocationCode.

SELECT qryYTDPRRawData forDashboardPRt oSales.Location Code,
Sum(qryYTDPRRaw DataforDashboar dPRtoSales.Payr ollThis) AS
YTDPayrollThis,
Sum(qryYTDPRRaw DataforDashboar dPRtoSales.Payr ollLast) AS
YTDPayrollLast,
qryYTDSalesRawD ataforDSashboar dPRtoSales.[YTDTY Sales] AS YTDSalesThis,

qryYTDSalesRawD ataforDSashboar dPRtoSales.[YTDLY Sales] AS YTDSalesLast,

[YTDPayrollThis]/[YTDSalesThis] AS YTDPercentSales This,
[YTDPayrollLast]/[YTDSalesLast] AS YTDPercentSales Last,
qryTotYTDChainS alesforDashboar d.ChYTDSalesThi s,
qryTotYTDChainS alesforDashboar d.ChYTDSalesLas t
FROM qryTotYTDChainS alesforDashboar d,
qryYTDPRRawData forDashboardPRt oSales INNER JOIN
qryYTDSalesRawD ataforDSashboar dPRtoSales ON
qryYTDPRRawData forDashboardPRt oSales.Location Code =
qryYTDSalesRawD ataforDSashboar dPRtoSales.Stor eNum

GROUP BY qryYTDPRRawData forDashboardPRt oSales.Location Code,
qryYTDSalesRawD ataforDSashboar dPRtoSales.[YTDTY Sales],
qryYTDSalesRawD ataforDSashboar dPRtoSales.[YTDLY Sales],
qryTotYTDChainS alesforDashboar d.ChYTDSalesThi s,
qryTotYTDChainS alesforDashboar d.ChYTDSalesLas t
HAVING (((qryYTDPRRawD ataforDashboard PRtoSales.Locat ionCode)<>"020" ));

Thanks - I don't know what to do anymore! Put the numeric data into a
temp talbe with a text field?

Sara

Nov 13 '05 #1
2 32752
Access does have some conversion functions between the various types that
you can use - however, the simplest thin gin this case would probably to
have an expression column that changes your number field to a text field
using Format$(Locatio n,"000") and joining that field to the other table
where Location is a 3 character text field...

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #2
Fantastic!! This worked. I figured there must be some sort of
conversion for this...I'm sure I'll now have occasion to use it again.
Again, I thank you.
Sara

Nov 13 '05 #3

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

Similar topics

2
8670
by: Robert McEuen | last post by:
Using Access 97, Windows XP I'm receiving a Numeric Field Overflow error during text import that I did not receive before I split my database. Another thread I found suggested that the cause of this error might be due to columns on the text file being in a different order than fields in the destination table, but they're the same in my case. I'm thinking a workaround might be to import to a temp table in the front-end, run an append...
1
3380
by: S. van Beek | last post by:
Dear reader, How can I filter a numeric field with Like as criteria in a query. To filter a numeric field with <10 as criteria this will com back with the result of those records for which the value is smaller as teen. But in case this value is variable and you prefer to work with "Like
2
7592
by: steve.turner | last post by:
Hi all, I'm hoping someone can stop me tearing (what's left of) my hair out over this problem... I have a linked Excel file from which I append the data to an empty local Access table. I have a macro which runs a delete query to empty the local table, then the append query to update it with the new info from the spreadsheet.
5
61209
by: dubing | last post by:
Hello everyone, There is a field of DATETIME type in our Access 2000 database. PHP is used to query the data and display the query results on the web. Does Access provide any function that can convert DATETIME field into a more user friendly format directly in query? I can do the following in MySQL. How should it be done in Access? SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
5
1955
by: Takeadoe | last post by:
I've got a favor to ask - Consider the following numeric field: 511 6805 3205 403 I need to make 2 new numeric fields from this variable, call it CS
4
3171
by: rzito | last post by:
I am looking for a technique with regards to the message displayed when you enter text into a numeric field. I obviously get the "The value entered isn't valid for this field" message how do I substitute this message for my own? I have tried before update (if notisnumeric(myfield.text), keydown. But I can not get it to wok, thanks in advance!
4
2849
by: janssensglb | last post by:
I want to export from Access 2000 a numeric field (double) to a text file. The export file should be fixed length (no delimiters), the field should have 9 digits in total, including 2 decimals. I want the field to be right aligned so that the decimal separator is always in the same column in the text file. I don't want to fill any leading blanks with zeros. I tried to do this using the format function in a query but I always end up with...
1
1584
by: AccessHunter | last post by:
Please Help.... I have a query with 2 tables, LegalFile and Cases. LegalFile has the field CaseID(Number Field) and Cases has CaseNbr(Text Field). I am trying to find entries that are in Legalfile but not in Cases. In order to club the conversion and join in one query I has the criteria for LegalFile.CaseID set to Int(). With this setup if I run the query it gives me all entries that are common in LegalFile and Cases. I tried setting...
1
3423
by: srinivasan2009 | last post by:
Hi, While Running macro i am getting error in a particular query "Numeric field overflow" For which i am opening that query and just saving the query. and query is starts executing.. Whether any solutions ....Pl reply with your feedback
0
8113
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
8051
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,...
0
8557
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8512
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8203
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
5504
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2517
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
1
1637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1373
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.