473,626 Members | 3,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

common code for list boxes


I want to build a function having the name of the list box
in brackets like Check(ListBoxIn voices).May i have some help as to how
to do it ?
In my form i have several list boxes.I have command buttons where the
following code is written:

If IsNull(Me![ListInvoices]) Then
DoCmd.Beep
MsgBox " Please select Invoice first ! "
Exit Sub
End If

The above code is OK. Actually i want to improve this code and make it
applicable to all such buttons, and only to change the name of the list
box.
There is a similar function for control like this:
Public Function Check(ctrl As Control)
If IsNull(ctrl) Then
DoCmd.Beep
MsgBox " Please select Student ! "
End If
End Function
But how can i rewrite it for the lists boxes?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
1 2154
Because the listbox *is* a control, the Check() function will work as is.

If you want a function that is specific for listboxes, you could code:

Public Function CheckLB(lst As ListBox)
If lst.ItemsSelect ed.Count = 0 Then
MsgBox "No items selected.
End If
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Hohn Upshew" <fa*****@yahoo. com> wrote in message
news:3f******** *************** @news.frii.net. ..

I want to build a function having the name of the list box
in brackets like Check(ListBoxIn voices).May i have some help as to how
to do it ?
In my form i have several list boxes.I have command buttons where the
following code is written:

If IsNull(Me![ListInvoices]) Then
DoCmd.Beep
MsgBox " Please select Invoice first ! "
Exit Sub
End If

The above code is OK. Actually i want to improve this code and make it
applicable to all such buttons, and only to change the name of the list
box.
There is a similar function for control like this:
Public Function Check(ctrl As Control)
If IsNull(ctrl) Then
DoCmd.Beep
MsgBox " Please select Student ! "
End If
End Function
But how can i rewrite it for the lists boxes?

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
6984
by: George | last post by:
Is there a way to customize the open file common dialog? I am trying to modify the button text so I can create a delete file common dialog. I need the same functionality of the open file common dialog but just need to change the button text from "open" to "delete". Any ideas? Thanks
8
2563
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
2
12609
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will select any skill in 1st drop down list then i'll select % of this skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display 2 sets of drop down list boxes at run time one for selecting skill and
1
1740
by: kmslick | last post by:
Hello all. Not sure which group this problem best relates to, so I'm posting to both with a follow up. I started learning C# and .NET last august for a project for my employer. The project involved extending explorer by creating a context-menu extension and allow certain actions to be performed on certain files. I was able to get that up and running through much searching on google, but the overall goal of the projects seems like it...
6
1916
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a button on the form that pops-up the common dialog. The cool way to do this would be to have the common dialog embedded in the wizard. I know it's possible, as I've seen other apps do this kind of thing, but I have no ideas how it can be achieved and...
4
1884
by: jmacduff | last post by:
I have a set of pages ( about 10 ) that all have the same controls at the top, however I am unable to put the controls the master page for the site since the other 50 pages dont have the controls. Is there a way that I can define a common template / etc where this code can live 1 place and then I can just use it / insert it onto these ten pages? So for example if you wanted to put 4 text boxes on 10 pages with the 4 text boxes exactly...
6
1736
by: Peter | last post by:
Hi I have a number of arrays of longs, from which I need to find a single array which only contains the values which appear in all the original arrays. For example, I could have the three arrays: 1, 3, 2, 8, 5 3, 6, 1
6
11479
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
8196
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
8637
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...
1
8364
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
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
7192
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
6122
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
4090
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...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1507
bsmnconsultancy
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...

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.