Question using dsum with a text box (1 Viewer)

MIkeD666

Registered User.
Local time
Today, 03:19
Joined
Jan 12, 2019
Messages
59
HI am a bit stuck on a small problem
I am using the dsum to get a total value from a field in a query. When I use the code 1 below it works fine
1) DSum("amount","QryPandLcaptialInvest","dateofinvestment >= #1-1-19# ")
But I want the user in in put the date in a text box on the form. But I have tried the 2 methods below and a few other ( I forgot to save) and get a type error.

This not worked =DSum("amount","QryPandLcaptialInvest","dateofinvestment > = # "+ [Text150] + "# ")

This not worked =DSum("amount","QryPandLcaptialInvest","dateofinvestment > = " + [Text150] )
Can any one point me in the right direction:banghead:
 

isladogs

MVP / VIP
Local time
Today, 11:19
Joined
Jan 14, 2017
Messages
18,239
Try this
Code:
=DSum("amount","QryPandLcaptialInvest","dateofinvestment>=#" & [Text150] & "#")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:19
Joined
May 7, 2009
Messages
19,247
what is the plus sign for?

=DSum("amount","QryPandLcaptialInvest","dateofinve stment > = # " & Format([Text150], "mm\/dd\/yyyy") & "# "
 

MIkeD666

Registered User.
Local time
Today, 03:19
Joined
Jan 12, 2019
Messages
59
& [Text150] & "#")worked first time. thanks al lot saved me a lot of time
 

isladogs

MVP / VIP
Local time
Today, 11:19
Joined
Jan 14, 2017
Messages
18,239
You're welcome. It will also work second time and every time subsequently …. :D
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:19
Joined
Feb 19, 2002
Messages
43,302
#' are delimiters for DATE fields. Single or Double quotes are delimiters for TEXT fields. NUMERIC fields are not delimited so unless Amount is a date, get rid of the delimiters.
 

Users who are viewing this thread

Top Bottom