473,440 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

date value issue

i have a report that tracks customer contacts by salespeople at a car
dealership. the contacts are assigned several values, one of which is the
date that they came in. the report is capeable of being run to any date
range specified by the user, which is a key feature for training of new
employees (ergo, changing this is not an option). the report is based on a
table of these contacts but in a few of its controls, does some dlookup,
dcount and dsum expressions to pull data from a table of sold cars. the
problem is this. the table of sold cars is created with monthly data. it is
not important for my facility to track the DATE the car was sold for the
purposes of this report. most of the time, in fact, the report will be run
on a whole month's data at one time. when this happens, the d-functions will
pull the # of sales for each salesperson for that month. if it's a 3 month
period of time, it works just as well as 1 month or 20 months. So here's the
problem: if someone wanted to run a report for a period of time that is not
either from the first day of a month or ending at the last day of a month,
how can i set up the visible property of some of these expressions to be
false? in more detail:

if txtboxstartdate = 10-1-05 and txtboxenddate = 10-31-05 then these controls
should be visible.
if txboxstartdate = 05-1-03 and txtboxenddate = 10-31-05 then these controls
should be visible.
if txtboxstartdate = 11-15-05 or txtboxenddate = 12-4-05 then these controls
should not be visible.

basically, how do you write an expression that evaluates two text boxs that
are formatted as mm/dd/yyyy to be whole month values or not? sorry if this
was wordy. thanks for looking.

--
Message posted via http://www.accessmonster.com
Dec 3 '05 #1
2 1501
On Sat, 03 Dec 2005 16:21:16 GMT, "ka******@comcast.net via
AccessMonster.com" <u15580@uwe> wrote:

Depending on your exact requirements, you could write some code in the
Report_Open event or the Report_Format event. The first if the
visibility is set based on the criteria specified by the user, the
second if visibility is based on the date for the particular row that
is being formatted.
Code similar to:
private sub SetVisibility(byval blnVisible as boolean)
dim ctlVisibility as Variant 'List of controls to be toggled
dim ctl as variant
ctlVisibility = Array("txtOne", "btnTwo", "txtThree")
for each ctl in ctlVisibility
ctl.Visible = blnVisible
next ctl
end sub

Call this sub using:
if (SomeCondition) then
SetVisibility True
else
SetVisibility False
end if

Or somewhat more concise:
SetVisibility SomeCondition
I don't exactly get the thrust of your last question. If you want to
know what month a particular date is in, just call the Month function.
If you want to know if two text fields have dates that span exactly
one month, then you could write code similar to:
if Day(Forms!MyForm!MyBeginDate)=1 and
Day(DateAdd("d",1,Forms!MyForm!MyEndDate))=1 then
'it's exactly 1 month
(Note how 1 day after the last day of a month is day 1)

-Tom.
i have a report that tracks customer contacts by salespeople at a car
dealership. the contacts are assigned several values, one of which is the
date that they came in. the report is capeable of being run to any date
range specified by the user, which is a key feature for training of new
employees (ergo, changing this is not an option). the report is based on a
table of these contacts but in a few of its controls, does some dlookup,
dcount and dsum expressions to pull data from a table of sold cars. the
problem is this. the table of sold cars is created with monthly data. it is
not important for my facility to track the DATE the car was sold for the
purposes of this report. most of the time, in fact, the report will be run
on a whole month's data at one time. when this happens, the d-functions will
pull the # of sales for each salesperson for that month. if it's a 3 month
period of time, it works just as well as 1 month or 20 months. So here's the
problem: if someone wanted to run a report for a period of time that is not
either from the first day of a month or ending at the last day of a month,
how can i set up the visible property of some of these expressions to be
false? in more detail:

if txtboxstartdate = 10-1-05 and txtboxenddate = 10-31-05 then these controls
should be visible.
if txboxstartdate = 05-1-03 and txtboxenddate = 10-31-05 then these controls
should be visible.
if txtboxstartdate = 11-15-05 or txtboxenddate = 12-4-05 then these controls
should not be visible.

basically, how do you write an expression that evaluates two text boxs that
are formatted as mm/dd/yyyy to be whole month values or not? sorry if this
was wordy. thanks for looking.


Dec 3 '05 #2
as it turns out, i couldn't use your or any other suggestion i found on this
site because my question was asked wrong. i didn't properly explain that the
date range in question must start on the first day of any month and end of
the LAST day of any month for my db to consider it to be a whole month.
because of the nature of my data, the range of the 1st to the 1st is no good.
so here's what i came up with.

If Day(Forms!formquerybuilder.Controls!txtboxstartdat e) = 1 Then
If Day(DateAdd("d", 1, Forms!formquerybuilder.Controls!
txtboxenddate)) <> 1 Then
Me.Text205.Visible = False
Me.Text206.Visible = False
Me.Text207.Visible = False
Me.Text208.Visible = False
Me.Text209.Visible = False
Me.Text210.Visible = False
Me.Text211.Visible = False
Me.Text212.Visible = False
End If
End If

now, i know it's ugly but it works and i didn't want to ignore your answer.
if you can see a flaw in what i did (besides being unnecessarily cumbersome --
but i hardly know vba at all so i'll live) please say so and i'll fix it.
i'm not proud. thanks for your time.
Tom van Stiphout wrote:
Depending on your exact requirements, you could write some code in the
Report_Open event or the Report_Format event. The first if the
visibility is set based on the criteria specified by the user, the
second if visibility is based on the date for the particular row that
is being formatted.
Code similar to:
private sub SetVisibility(byval blnVisible as boolean)
dim ctlVisibility as Variant 'List of controls to be toggled
dim ctl as variant
ctlVisibility = Array("txtOne", "btnTwo", "txtThree")
for each ctl in ctlVisibility
ctl.Visible = blnVisible
next ctl
end sub

Call this sub using:
if (SomeCondition) then
SetVisibility True
else
SetVisibility False
end if

Or somewhat more concise:
SetVisibility SomeCondition

I don't exactly get the thrust of your last question. If you want to
know what month a particular date is in, just call the Month function.
If you want to know if two text fields have dates that span exactly
one month, then you could write code similar to:
if Day(Forms!MyForm!MyBeginDate)=1 and
Day(DateAdd("d",1,Forms!MyForm!MyEndDate))=1 then
'it's exactly 1 month
(Note how 1 day after the last day of a month is day 1)

-Tom.
i have a report that tracks customer contacts by salespeople at a car
dealership. the contacts are assigned several values, one of which is the

[quoted text clipped - 24 lines]
are formatted as mm/dd/yyyy to be whole month values or not? sorry if this
was wordy. thanks for looking.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #3

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

Similar topics

3
by: Jay | last post by:
I previously posted this question under Visual Basic newsgroup, but was advised to re-post here. I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000. Here's...
2
by: sandy | last post by:
Hello, I am trying to automate a date. When typing in the issue date I want it to automatically calculate 6 months fronm the issue date and give me the Expiration date. Following is code that I am...
4
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
4
by: Joe User | last post by:
Hi all....I have a feeling this is going to be one of those twisted query questions, but here it goes anyways.... I want to generate a report that shows the chronology of events (represented by...
2
by: Oenone | last post by:
In our applications, we use the special value of DateTime.MinValue to represent "null dates" throughout all our code. We recently ran into an issue where we wanted an optional date parameter for a...
21
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is...
9
by: Kenevel | last post by:
Hi everyone, Has anyone come across a problem where on Linux using DB2 9.1 Express- C with the packaged jcc-JDBC driver that it fails correctly to parse a returned date value? I'm simply calling...
9
by: Frank Swarbrick | last post by:
I've probably asked this before, but I can't remember the answer! One can use the DECIMAL function to convert a date to a decimal. For instance values decimal(current_date) returns 20080528. ...
1
Stang02GT
by: Stang02GT | last post by:
Here is the issue that I am having. I have two text feilds where users need to enter a "From Date:" and a "To Date:" they then hit a update button and my code will pull back the data for the date...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
1
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...
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
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.