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 8581
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: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |