Question using dsum with a text box

MIkeD666

Registered User.
Local time
Today, 01:44
Joined
Jan 12, 2019
Messages
62
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:
 
Try this
Code:
=DSum("amount","QryPandLcaptialInvest","dateofinvestment>=#" & [Text150] & "#")
 
what is the plus sign for?

=DSum("amount","QryPandLcaptialInvest","dateofinve stment > = # " & Format([Text150], "mm\/dd\/yyyy") & "# "
 
& [Text150] & "#")worked first time. thanks al lot saved me a lot of time
 
You're welcome. It will also work second time and every time subsequently …. :D
 
#' 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

Back
Top Bottom