473,836 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dsum , using Numeric and Text fields ????

Acc 97
Hi,

I have the following in my query which works well if it is all set to
numbers on table design.

But what I want to do is where it states MC (short for machine name) use the
actual machine name of which there are 5 off. therefore, on the table design
I flick it over to text mode.

the query throws a wobbler! and all I get is Error!!

would a kind knowledgeable sole, show me how I need to modify this, so that
I can use Text setting only the end parts as identified as "MC="&[MC]
Note this works OK if all is numeric

DSum("[tot]","[Query1]"," Expr1="& [Expr1]& "AND " & " " & "MC=" &[MC])

Thanks, Alex
Nov 12 '05 #1
1 4160
When you're querying against a text field, you need to enclose the value in
quotes. You can do this using single quotes, but you'll run into problems if
your string contains an apostrophe in it (O'Reilly), so my usual advice is
to use Chr$(34):

DSum("[tot]","[Query1]"," Expr1= " & [Expr1] & "AND MC= " & Chr$(34) & [MC]
& Chr$(34))

If you're not concerned about apostrophes:

DSum("[tot]","[Query1]"," Expr1= " & [Expr1] & "AND MC= '" & [MC] & "'")

Exagerated, so that the quotes are easier to see:

DSum("[tot]","[Query1]"," Expr1= " & [Expr1] & "AND MC= ' " & [MC] & " ' ")

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Alex" <ge****@yas1.fr eeserve.co.uk> wrote in message
news:b7******** *************** **@posting.goog le.com...
Acc 97
Hi,

I have the following in my query which works well if it is all set to
numbers on table design.

But what I want to do is where it states MC (short for machine name) use the actual machine name of which there are 5 off. therefore, on the table design I flick it over to text mode.

the query throws a wobbler! and all I get is Error!!

would a kind knowledgeable sole, show me how I need to modify this, so that I can use Text setting only the end parts as identified as "MC="&[MC]
Note this works OK if all is numeric

DSum("[tot]","[Query1]"," Expr1="& [Expr1]& "AND " & " " & "MC=" &[MC])

Thanks, Alex

Nov 12 '05 #2

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

Similar topics

0
3357
by: Rolan | last post by:
I'm using Access 97 and need some assistance in sorting out a proper DSum expression, or maybe even DCount might be an alternative. I have tried numerous combinations, but with no apparent success. The DSum function relates to a subform (sfrmCost) with a text box (RefCost) which is intended to be the container for a total from a query (qryItems). The query has three number columns from the table (tblItems) of which I have an expression...
2
11600
by: Dalan | last post by:
I seemed to be having problems with structuring the use of NZ with a DSum expression. Having tried numerous variations of the expression without success, I'm asking for assistance. First some background (Access 97) - the DSum expressions are being used in grand total text boxes on the footer of a subform. And when viewing the subform in the linked main form the two grand total boxes display #Error if no entry had been made. Those with...
1
1468
by: GERALD SHAW | last post by:
Acc 97 Hi, I have the following in my query which works well if it is all set to numbers on table design. But what I want to do is where it states MC (short for machine name) use the actual machine name of which there are 5 off. therefore, on the table design I flick it over to text mode.
3
3772
by: Mark Reed | last post by:
All, I have never used this function before and am not sure it what I need. Just to clarify, I have a report based on a query which has amoungst other field, wk, parea & packs_req. What I am trying to do is create a subreport for the main report which gives a generalised breakdown of the main report. For the gender of 'Ladies', there may be several parea's so I want to sum the packs_req for ladies only. (Gender is not a field I can use,...
8
4441
by: deercreek | last post by:
I have the following table test3. RESERVATIONID Site SitePrice 101 RV2 $25.00 101 RV3 $25.00 102 RV4 $25.00 102 RV5 $25.00 104 RV10 $25.00 I created a query with the following dsum
2
2136
by: emc_cos | last post by:
So I am relatively new to Access so please bare with me... I have been able to create a very functional form that will be utilized for time entry for tasks. The primary form is a record entry type that has a unique file number for each entry. At the bottom of the form I have a set of control buttons that when
2
1841
by: valley | last post by:
Hello, I had asked this before but the thread was closed for other reasons. I have two Numeric fields in my Form, MCRef and MCTot. Actually MCtot is the sum of all MCRef for a given Cust_ID I have the following expression in the Default value of MCtot in my form showing both the fields DSum("","Miracle_Cloth_Main","='" & & "'")
13
5846
by: ringer | last post by:
Hi, I have a text box on report where I need to have dsum return a total. The records I need the total from are not in the table that is the report's recordsource, and to complicate things further, I need to use a variable that is derived from behind the report in the criteria for the dsum. When I try to see print preview, this version of the statement errors before opening saying "Access cannot find the field 'SavingsPeriodEndDate'...
2
3365
by: Gulnarambi | last post by:
I have a form in datasheet view with Total and Currency text boxes, in Currency text box I only can enter values of AZN and USD. Form is based on Table and as criterias information fromUnbound control from another form is used, In form footer I need to create too text boxes, one of then shoul calculate sum of Total for records where currency field equals to USD and other one calculates sum for Total for records where Currency field equals to...
0
9812
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
10533
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
10579
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
10244
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
9362
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
5644
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5813
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
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
3
3103
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.