By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Dsum , using Numeric and Text fields ????

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.freeserve.co.uk> wrote in message
news:b7*************************@posting.google.co m...
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 discussion thread is closed

Replies have been disabled for this discussion.