473,473 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Date Variable in DSum function

Dim vDateE As String
vDateE = #7/12/2005#
The following works to find Cost in TblExpenses for 7/12/2005:

MsgBox (DSum("Cost", "TblExpenses", "DateofPurchase = #7/12/2005#"))

However I have worked for hours to try and put a variable in place of
#7/12/2005#

Can someone give advice on this syntax -

Thank you in advance.

Michael Silane

Nov 13 '05 #1
6 7016
Hello Mike

Try, MsgBox(DSum("Cost", "TblExpenses", "DateofPurchase = #" & vDateE
& " # "))

good luck,

Mike wrote:
Dim vDateE As String
vDateE = #7/12/2005#
The following works to find Cost in TblExpenses for 7/12/2005:

MsgBox (DSum("Cost", "TblExpenses", "DateofPurchase = #7/12/2005#"))

However I have worked for hours to try and put a variable in place of
#7/12/2005#

Can someone give advice on this syntax -

Thank you in advance.

Michael Silane


Nov 13 '05 #2
Mike wrote:
Dim vDateE As String
vDateE = #7/12/2005#
You might want to dim vDateE as a Date,
The following works to find Cost in TblExpenses for 7/12/2005:

MsgBox (DSum("Cost", "TblExpenses", "DateofPurchase = #7/12/2005#"))
The date is surrounded by # signs.
However I have worked for hours to try and put a variable in place of
#7/12/2005#

Can someone give advice on this syntax -
Well...you assigned a date, #7/12/2005# to the variable. But what is
contained between a "" is what makes up a string. And if you put
"DateofPurchase = vDateE"
you are basically asking something the computer something but what is a
DateofPurchase = vDateE?

So you need to split it out. And you need to surround the date variable
with #'s because its a date.
"DateofPurchase = #" & vDateE & "#"

Thank you in advance.

Michael Silane

Nov 13 '05 #3
Mike wrote:
Dim vDateE As String
vDateE = #7/12/2005#
The following works to find Cost in TblExpenses for 7/12/2005:

MsgBox (DSum("Cost", "TblExpenses", "DateofPurchase = #7/12/2005#"))

However I have worked for hours to try and put a variable in place of
#7/12/2005#

Can someone give advice on this syntax -


What the others said but also you should force the date into a specific
format (e.g. mm/dd/yyyy) so that it will work in other countries or a
visitor with his/her own laptop with different country settings won't
have a problem.
Nov 13 '05 #4
That worked - thanks again.

Mike S

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5

Your syntax worked - did not have to Dim as Date
Thanks for the help.
Mike S

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #6
Thanks for the good suggestion

Mike S

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #7

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

Similar topics

0
by: seanseaghan | last post by:
New to this group, so greetings all! I am trying to develop query syntax in Access 2000 to accomplish the following: Imagine you are in an accounting dept. and you are working on a...
3
by: Liam Mac | last post by:
Hi All, Can anyone direct me or provide advice on how I can assign a null value to a date variable in vb.net. Basically what I'm doing is that I'm looping through a recordset where I have three...
6
by: ckpoll2 | last post by:
Hi, I have made a report that has a query as its record source. I put a text box in there that I want to run a dsum function off of a different query. The criteria that I need to use is that it...
3
by: technocraze | last post by:
Hi community experts, I am having an isue with Dsum function that is used to count the total number for a particular field (intake) at the textbox afterupdate event with condition/ criteria...
1
by: zaiena | last post by:
hello, i'm having this problem when try to display the total amount form subform to form,for example i'm having two tables one for the products which contains(p_no,p_name,price),and the other table...
9
by: BlackJack17 | last post by:
Alright you all have been so helpful with everything else that I thought I'd run one more issue by you. I have put together a report that is driven by a query. This query (Unique Records) returns...
5
by: gubbachchi | last post by:
Hi all, How to pass the php date variable to javascript function. Here is the code I have tried out, but this is not recovering the date correctly in the javascript function <html> <script...
4
by: wassimdaccache | last post by:
dears I have a continuous forms. It contains 2 fields I made another field to check their accounts. it is . the source of is based on a DSUM function. "it is working well" Now I want to...
2
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.