473,395 Members | 1,458 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,395 software developers and data experts.

How to prevent a blank form when a list box return no data?

Dany
1
HI Everyone,
I am trying to create a simple form that contains three list boxes, each one is based on a query. For example, The first one has the row Source as follows:
Expand|Select|Wrap|Line Numbers
  1. Select Id, Emp_name
  2.   From Tbl_Employee
  3.  Where Hire_date < "01/01/2010"
  4.  
The second and the Third list box are based on the same query but with different condition. Everything is good so far. But whenever the second list box returns no data, the whole form goes blank even if the first and third list box return Data. What could be the property I should change?

Things I tried:
- I deleted the second list box, than I duplicated the first list box and changed its condition. Same result.
- I deleted the second list box and everything went good, but this time, with only 2 list boxes, whenever the first list box returns no data, the whole form goes blank again.

Any help please.
Regards.
Nov 21 '11 #1
2 2569
sierra7
446 Expert 256MB
Hi Dany
I'm not a fan of ListBoxes but will try and creat a blank one in a minute and get back.

I know that if there are calculated fields on a form and one goes wrong, then they all show an error.

I'm curious why your code works because Access usually wants dates inside hashes (#) eg
Expand|Select|Wrap|Line Numbers
  1. Select Id, Emp_name 
  2. From Tbl_Employee 
  3. Where Hire_date < #01/01/2010# 
  4.  
What are your other criteria? Is it just that there are no results or is Access calling 'Foul!'?

Are you in the UK and putting in a UK date? If you put in today as '21/11/2011' Access will be wondering what month 21 is?

S7
Nov 21 '11 #2
NeoPa
32,556 Expert Mod 16PB
I'm just wondering what you're not telling us. You don't say if the form is even bound. The only scenarios I can imagine where no records show are :
  1. The ListBox is bound to a field and the record has a value for that field.
  2. You are applying filtering based on these ListBoxes and you just didn't bother to tell us.

Either way it seems like a incomplete question (though to be fair, I notice it is well formatted and some effort was applied to make the question a good one, so no criticism due).

PS. Access (or more precisely Jet SQL) is too clever (unfortunately for many) to be confused by a date of 21/11/2011 (hence so many get confused by international dates in SQL). Where it falls over is in determining that a date of #7/6/2011# is intended by most Europeans to reflect 7th June because the SQL standards insist that should be done as m/d/yyyy, which would be #6/7/2011#. Most dates are determinable even though they're put in back-to-front (21/11/2011 makes no sense in SQL format so it guesses, correctly, that it should really have been 11/21/2011), which is why so many people fail to see they have their date literals the wrong way around until after the project is released.
Nov 21 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: John | last post by:
How do I prevent blank data from being entered into a table? For instance, the user fills out a form, but if a field is left blank, then the entire entry won't be filled in. This isn't...
5
by: Batezz | last post by:
I have created a form (below) How do I stop it redirecting to another page (productsearchresults.php) when form is submitted if both the fields are blank? Any help appreciated. Batezz
2
by: www | last post by:
Hi there, I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes to my update stored procedure. The stored procedure expect values, so how can I detect if a form field was...
6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
1
by: Andrew | last post by:
I recently copied an old form and modified it with new fields and such, and now when I try to simply open the form (view it to enter data) there is nothing but the header showing! The header is...
9
by: Sandy | last post by:
Hi all, I have a form to list records (frmListIssue) which I call from different other forms. My wish is to display a message when the form is called and empty; no records to display. I want to...
0
by: Roger Allen | last post by:
I have created an empty vb project in Visual Studio 2005, it just displays a blank form. When I run the program from the development environment, I get the error: "A first chance exception of...
5
by: raulavi | last post by:
vb VS 2003 Hi all: thanks to all in advance for your responses. my app displays the form , then when it reaches a debbuging point the form is blanked, (it just shows the frame around the form) I...
3
by: Brian | last post by:
I have a form that has a textbox used to search records in a table. On the form I have a listbox which shows each record in the table. When you click on each row in the listbox the rest of the form...
1
by: hexagram | last post by:
hi guys can anybody can teach me how to do this scenario Transfering Data of a form to a new form The Scenario is: I have a Delivery Receipt Form (Hardware) with a fields of the following ...
0
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...
0
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
0
BarryA
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...
1
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...
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
marktang
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,...
0
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...
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...
0
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...

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.