Hi
I have a strange problem in a form filter my set up is as follows
there is a form named "InAlarmResumeF orm" that has a subform "AlmActiveQrySf orm" the form has Textboxes with datapicker enabled "StartDate" and "EndDate" for the user to pick dates to apply to the subform filter.
the way this works is , if the user pick a date in the "StartDate" TextBox and left empty the "EndDate", the filter looks for register with the "StartDate" as its date if the user fill the "StartDate" and "EndDate" TextBoxes the filter will bring data between 2 dates, it seems to work . . but reviewing all the data I have in the query where the Subform is based , I can see data from dates between 12/09/11 to 15/09/11 ,and using the form filters I can make it works only for dates from 13/09/11 to 15/09/11, if I pick a single date from 06/09 to 12/09 the form returs zero records
If I use the 2 date boxes with dates in this range (06/09 to 12/09) the form returns data from the 09/09 to the high limt I set on the End date
If I choose the end date in the "suspected" range it will return zero records
here is the code for the Button that trigger the filter - Private Sub DateSearchBTn_Click()
-
Dim DateFilter As String
-
If Me.EndDate = "" Then _
-
DateFilter = "([AlmDate]=#" & Me.StartDate & "#)"
-
Form_AlmActiveQrySform.Filter = DateFilter
-
Form_AlmActiveQrySform.FilterOn = True
-
Debug.Print DateFilter
-
If Me.EndDate <> "" Then
-
DateFilter = "([AlmDate] Between #" & Me.StartDate & "# And #" & Me.EndDate & "#)"
-
Form_AlmActiveQrySform.Filter = DateFilter
-
Form_AlmActiveQrySform.FilterOn = True
-
Debug.Print DateFilter
also here is the code from the query where the form is based - SELECT ALARMHISTORY.Al_Start_Time, CInt(Nz((Sum(DateDiff("n",[Al_start_Time],[Al_norm_Time]))),0)) AS AlmActiveTime, Format([Al_Start_Time],"dd/mm/yyyy") AS AlmDate, Format((Right([Al_Start_Time],13)),"Short Time") AS AlmTime, ALARMHISTORY.Al_Tag, ALARMHISTORY.Al_Norm_Time
-
FROM ALARMHISTORY
-
GROUP BY ALARMHISTORY.Al_Start_Time, Format([Al_Start_Time],"dd/mm/yyyy"), Format((Right([Al_Start_Time],13)),"Short Time"), ALARMHISTORY.Al_Tag, ALARMHISTORY.Al_Norm_Time
-
HAVING (((ALARMHISTORY.Al_Norm_Time) Is Not Null));
The AlmDate field wich is the one I'm filtering in the Query comes from a timestamp field [Al_Start_Time] that is formated as dd/mm/yyyy hh:nn:ss
hope some body can help
Best regards
Raymundo Walle
3 2854 ADezii 8,834
Recognized Expert Expert
Try: -
Dim DateFilter As String
-
-
If Me.EndDate = "" Then
-
DateFilter = "([AlmDate]=#" & Me.StartDate & "#)"
-
Else
-
DateFilter = "([AlmDate] Between #" & Me.StartDate & "# And #" & Me.EndDate & "#)"
-
End If
-
-
With Form_AlmActiveQrySform
-
.Filter = DateFilter
-
.FilterOn = True
-
End With
NeoPa 32,566
Recognized Expert Moderator MVP
Controls never resolve to "". If there is no data entered then the control will be Null.
SQL dates are not in local format but in specific SQL Date format (See Literal DateTimes and Their Delimiters (#)).
Thanks for the Answers ,
I think it is related with the date format what I did is before put dates in filters I formated them using - Format([AlmDate],"mm/dd/yyyy")
also did the same for the Field [Al_Start_Time] so both the field to search and the search box date are in the same format
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Google Mike |
last post by:
I have RH9 Linux with the versions of Apache and PHP that came with
it. The PHP is version 4.2.2 on the CD, I believe. Apache, I think, is
version 2.0.
I found I can do some regular PHP stuff like pull data back from MySQL
and show it, but posting form data from one web form to another web
page simply doesn't work for some reason. Has anyone seen this?
Example:
|
by: AnnMarie |
last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it
works fine in IE.
I made some of the suggested changes which enabled it to work in IE.
I couldn't make all the changes because then it didn't work in IE.
How can I enable this javascipt form validation to work in Netscape?
When I use netscape, none of the alert boxes appear. It submits the
form without validating anything.
|
by: lmeng |
last post by:
Hi,
I am new to this Forum. Thanks in advance for any kind help.
In the following HTML code, when I change the value of one text field
then click "Modify" button, if the validation fails a message will
popup and the cotent of the form should NOT be submitted. (The actual
code connects to the database at the backend so I can check if the
value is submmited).
|
by: Larry |
last post by:
I have made a form class, it is an about box.
the form (the form class) resides in a project where I call it from a
test form.
Everything works ok.
But, When I copy the form class (frmabout.vb file) into another
project, and attempt to use it, it doesn't work, the project hangs when
I run it.
I opened up the form (frmabout.vb), the new copy in the new project,
|
by: Brett Porter |
last post by:
Hi,
I have many, many forms that use all of the different form validation
controls. These work great on my local server however I have just been
alerted to the fact that the form validation doesn't work at all on
the web server causing all sorts of differing problems.
I would assume that it has something to do with the JavaScript for the
client side form validation however this is as far as I get.
| |
by: alan_atwood |
last post by:
Hello all. I am having a problem with the submit() method that is
driving me nuts. I'm using document.form.submit() with large text
fields (approx. 2000 characters) and am getting a "Invalid Syntax"
error. If I do the same thing with a text field of under 1500
characters, it works fine.
Is there some size limit here that I don't know about? Haven't been
able to find anything so far on this particular problem.
Thanks,
|
by: MLH |
last post by:
I don't always get what I want when I invoke the following
Me!MySubFormControl.Refresh
from code running in the main form. Am I doing something
wrong here? Someone suggested that I open the subform
itself (as a separate form) in hidden view anytime I open
the main form and attempt my refreshes there. I think that
is somewhat redundant and can't be what MicroSoft intended.
|
by: moho |
last post by:
Hi
I'm trying to load a form into a div (that's hidden and then set to visible) = the form gets a page and stores it inside.
I activate it by pressing a button.
Then the div will fill in some values in the form elements that it has.
however this doesn't work.
the page is loaded but document.getElementById doesn't find it. When I look in
the HTML it's all there.
|
by: VMI |
last post by:
I have a Windows Form and, for its BackgroundImage, I put an all-white
bitmap (opened mspaint, and immediately saved as bmp). Then I set the
TransparencyKey property to White (I also added it in the Form_Load). For
some reason I still can't see "through" the Form. Am I doing something
wrong? The RightToLeftLayout property is set to False.
On the other hand, if I remove the background image and set Form.BackColor
to White, it'll work.
I'm...
|
by: liams |
last post by:
Hi, I recently learned how to use AJAX, but I'm having a problem with it. What I'm trying to do is validate a form with PHP, and write the output of the validation in the same page. From the last question I have asked in bytes.com, I was introduced to AJAX(well, I always knew it, but I never used it). So, I wrote the following code accordingly:
index.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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...
|
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...
|
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();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |