473,664 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1510
On Sat, 03 Dec 2005 16:21:16 GMT, "ka******@comca st.net via
AccessMonster.c om" <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(b yval 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!MyFor m!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!formq uerybuilder.Con trols!txtboxsta rtdate) = 1 Then
If Day(DateAdd("d" , 1, Forms!formquery builder.Control s!
txtboxenddate)) <> 1 Then
Me.Text205.Visi ble = False
Me.Text206.Visi ble = False
Me.Text207.Visi ble = False
Me.Text208.Visi ble = False
Me.Text209.Visi ble = False
Me.Text210.Visi ble = False
Me.Text211.Visi ble = False
Me.Text212.Visi ble = 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(b yval blnVisible as boolean)
dim ctlVisibility as Variant 'List of controls to be toggled
dim ctl as variant
ctlVisibilit y = 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:
SetVisibilit y 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!MyFor m!MyBeginDate)= 1 and
Day(DateAdd("d ",1,Forms!MyFor m!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.c om
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
7824
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 the issue. I hope I've included all relevant information. On a form, I have a DateTimePicker with the following
2
2493
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 using: <td>Visa Issued Date:</td> <td><input name="visaIssueDate" type="text" size="8" maxlength="8" value="#DateFormat(get_NamesContacts.VisaIssueDate, 'mm/dd/yy')#" onBlur="checkDate(this)"></td> <td>Expiration Date:</td>
4
3435
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 to select today. example: var dtToday = Date() if(document.frmSoftware.txtDDate.value == dtToday) { alert("You cannot select same day distributions. Please enter a new
11
4647
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 having a heck of a time doing so. I have created a form where I use drop downs do specify year, month, date, hour, minute and seconds. When the form is loaded, the dropdowns have to display the proper values for the current time zone type. This
4
6285
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 field names). Essentially, I would like to sort the DATE FIELDS for each record in the table by the order of the DATES in those DATE FIELDS. For example: record ID= 354
2
11915
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 procedure. We weren't able to declare it with DateTime.MinValue as its default value, as MinValue is a read-only property rather than a constant. To work around, we had to use a "magic date" that we checked for later on. I was never very happy...
21
3369
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 USA is mm/dd/yyyy and mexico is dd/mm/yyyy. So, with the computer set to mexico, any standard CDATE function is going to return the date in the dd/mm/yyyy setting since that is what the computer is set to. I want to be able to enter a date in...
9
5456
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 resultSet.getDate(paramIndex) and it's giving me a date that's way off.
9
4700
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. Is there an easy way to convert the decimal value back to a date? I can't use DATE(<decimal-value>) because it expects the decimal value to be the number of days since Jan 1, 0001.
1
1549
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 ranges they have selected. If the user enters the same date in both from and to fields they are expecting to see just one row returned for that day, BUT what is really happening is it is returning all the data. Does anyone have any suggestions or...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8861
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8778
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.