Hi,
I really hope someone can help me because I've already spend 2 days on
this problem and I'm not getting anywhere. I think the problem is that
I don't really understand how text boxes store 'empty' values. I'm
trying tot do the following.
I have a continous sub form that lists transactions. On the top level
form I have some text boxes to let the user specify the transactions
between which dates should be listed. To do this I have two text boxes
with a date format: one for the from date (ctlFrom) and ane for the to
date (ctlTo). Whenever one of the two boxes are updated I requery the
subform. When the boxes are empty I want the query to return all
transactions. The query I use for the subform is:
SELECT account, date, amount, specification FROM tblTransactions
WHERE
((date > Forms!MainForm!ctlFrom) OR (Forms!MainForm!ctlFrom=""))
AND
((date > Forms!MainForm!ctlTo) OR (Forms!MainForm!ctlTo=""));
This works when the text boxes (ctlFrom and ctlTo) contain date values
but not when the text boxes are empty. I've also tried to use NULL
instead of the empty string but the results are the same. Does anyone
know what value I should use to test for an empty box, or perhaps
there are better approaches to what I'm doing.
Thanks, Gertjan 7 8631
Gertjan van Heijst wrote: Hi,
I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store 'empty' values. I'm trying tot do the following.
I have a continous sub form that lists transactions. On the top level form I have some text boxes to let the user specify the transactions between which dates should be listed. To do this I have two text boxes with a date format: one for the from date (ctlFrom) and ane for the to date (ctlTo). Whenever one of the two boxes are updated I requery the subform. When the boxes are empty I want the query to return all transactions. The query I use for the subform is:
SELECT account, date, amount, specification FROM tblTransactions WHERE ((date > Forms!MainForm!ctlFrom) OR (Forms!MainForm!ctlFrom="")) AND ((date > Forms!MainForm!ctlTo) OR (Forms!MainForm!ctlTo=""));
This works when the text boxes (ctlFrom and ctlTo) contain date values but not when the text boxes are empty. I've also tried to use NULL instead of the empty string but the results are the same. Does anyone know what value I should use to test for an empty box, or perhaps there are better approaches to what I'm doing.
Thanks, Gertjan
Just before you requery you could test for the values of the textboxes. I
presume this is in the after_update event.
e.g
If isnull(me.ctlFrom.value) Then
'use different query that selects all records
Else
'use query you specified above
End if
hth
Martin
shouldn't it be date <= Forms!MainForm!ctlTo?
"Gertjan van Heijst" <gv******@xs4all.nl> wrote in message
news:55*************************@posting.google.co m... Hi,
I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store 'empty' values. I'm trying tot do the following.
I have a continous sub form that lists transactions. On the top level form I have some text boxes to let the user specify the transactions between which dates should be listed. To do this I have two text boxes with a date format: one for the from date (ctlFrom) and ane for the to date (ctlTo). Whenever one of the two boxes are updated I requery the subform. When the boxes are empty I want the query to return all transactions. The query I use for the subform is:
SELECT account, date, amount, specification FROM tblTransactions WHERE ((date > Forms!MainForm!ctlFrom) OR (Forms!MainForm!ctlFrom="")) AND ((date > Forms!MainForm!ctlTo) OR (Forms!MainForm!ctlTo=""));
This works when the text boxes (ctlFrom and ctlTo) contain date values but not when the text boxes are empty. I've also tried to use NULL instead of the empty string but the results are the same. Does anyone know what value I should use to test for an empty box, or perhaps there are better approaches to what I'm doing.
Thanks, Gertjan
Test ctlFrom and ctlTo prior to constructing your query, if they are null,
assign them values that will include all the data in your table, IE:
ctlFrom = #1/1/1900#
ctlTo = Now()
"Gertjan van Heijst" <gv******@xs4all.nl> wrote in message
news:55*************************@posting.google.co m... Hi,
I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store 'empty' values. I'm trying tot do the following.
I have a continous sub form that lists transactions. On the top level form I have some text boxes to let the user specify the transactions between which dates should be listed. To do this I have two text boxes with a date format: one for the from date (ctlFrom) and ane for the to date (ctlTo). Whenever one of the two boxes are updated I requery the subform. When the boxes are empty I want the query to return all transactions. The query I use for the subform is:
SELECT account, date, amount, specification FROM tblTransactions WHERE ((date > Forms!MainForm!ctlFrom) OR (Forms!MainForm!ctlFrom="")) AND ((date > Forms!MainForm!ctlTo) OR (Forms!MainForm!ctlTo=""));
This works when the text boxes (ctlFrom and ctlTo) contain date values but not when the text boxes are empty. I've also tried to use NULL instead of the empty string but the results are the same. Does anyone know what value I should use to test for an empty box, or perhaps there are better approaches to what I'm doing.
Thanks, Gertjan
"Gertjan van Heijst" <gv******@xs4all.nl> wrote in message
news:55*************************@posting.google.co m...
<snip> SELECT account, date, amount, specification FROM tblTransactions WHERE ((date > Forms!MainForm!ctlFrom) OR (Forms!MainForm!ctlFrom="")) AND ((date > Forms!MainForm!ctlTo) OR (Forms!MainForm!ctlTo=""));
This will work:
between iif(isnull(Forms!MainForm!ctlFrom),[date],Forms!MainForm!ctlFrom)
AND
iif(isnull(Forms!MainForm!ctlTo),[date],Forms!MainForm!ctlTo)
Also, I'd advise against a field named date, since there is a function with
the same name. It could cause confusion or errors at some point. Use
dateVal or somesuch thing instead.
HTH
Yon-Paul Thanks, Gertjan
Or possibly
If Len(Trim$(myTextBox.Value & "")) = 0 Then
to also catch those cases where the textbox contains one or more spaces, and
nothing else.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:g9********************************@4ax.com... The *BEST* way to look for either empty or null textbox values (regardless if it's a date, number or text) is to use the syntax:
if len(myTextBox.Value & "") = 0 then
The & "" part above supplies a length of 0 to a Null (or empty) value, but does nothing if it has anything in it.
You can also use this when you're going through recordsets.
On 30 Aug 2003 05:16:59 -0700, gv******@xs4all.nl (Gertjan van Heijst) wrote:I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store 'empty' values. I'm trying tot do the following.
-- You Have Two Choices For Dinner: Take It Or Leave It.
"Douglas J. Steele" <dj******@canada.com> wrote in message
news:xK********************@news01.bloor.is.net.ca ble.rogers.com... Or possibly
If Len(Trim$(myTextBox.Value & "")) = 0 Then
to also catch those cases where the textbox contains one or more spaces,
and nothing else.
Is it possible to enter one or more spaces, and nothing else, into a textbox
via the keyboard?
"rkc" <rk*@yabba.dabba.do.rochester.rr.com> wrote in
news:nu*******************@twister.nyroc.rr.com: Is it possible to enter one or more spaces, and nothing else, into a textbox via the keyboard?
It's not possible here in Canada (for me, anyway), but I've always assumed it
was there in the USA to faciliate entry of "Reasons for the Invasion of
Iraq", or "Location of Iraq's WMD Caches"?
--
Lyle This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: News Groups |
last post by:
Hello Asp Programmers,
I have a question. I have a form on an ASP page that has 5 text boxes, for
data
entry. I am trying to get data from the text box, and pass it to a hidden
text box on...
|
by: RC |
last post by:
I have a form with five text boxes on it. The format for all the boxes
is set as General Number. In four of the boxes the user can enter a
number, the fifth box totals up the values in the other...
|
by: gi75research |
last post by:
What should be a very simple function is going terribly wrong, and I
don't know why. StartTime and EndTime are table values (formatted like
"01:00A" or "02:00P"); DaypartStart and DaypartEnd are...
|
by: EDOnLine |
last post by:
New asp.net/webform user question......
I am trying to use the Custom Validator control to check to see if either of
two fields on my form have been filled in. At this point all I am
interested...
|
by: Xero |
last post by:
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.
I am writing a calculator and requires users to enter two numbers. After...
|
by: Josh |
last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI
screens) that we want to get out of VB and into a better language. The
program is over 10 years old and has already been...
|
by: Netkiller |
last post by:
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Project: Network News Transport Protocol Server Program
Description:
基于数据库的新闻组,实现BBS前端使用NNTP协议来访问贴子...
|
by: Petyr David |
last post by:
Just looking for the simplest. right now my perl script returns an
error messge to the user if the date string is invalid. would like to
do this before accessing the server.
TX
|
by: keri |
last post by:
Hi,
I have a table with 2 fields - flddate and category.
The values of flddate are all working day dates (monday to friday
dates between jan 2007 and 2010 (although the end date could change)....
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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,...
|
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...
| |