473,586 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListIndex as Variable?? Access 2003, XP

12 New Member
I need a little advice here...

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Global ind As integer
  3.  
  4. Private Sub someobject_on click()
  5. ind = 5
  6. End Sub
  7.  
  8. Public Function somefunction()
  9. Forms![someform].[somelistbox].SetFocus
  10. Forms![someform].[somelistbox].ListIndex = ind
  11. End Function
  12.  
  13.  
I am not understanding why this will not work so that on an "on_click" routine I can set the list index value to a global variable and call that variable in a public function??? What am I doing wrong here. Thanks in advance you guys/gals.
Nov 17 '07 #1
3 2596
ADezii
8,834 Recognized Expert Expert
I need a little advice here...

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Global ind As integer
  3.  
  4. Private Sub someobject_on click()
  5. ind = 5
  6. End Sub
  7.  
  8. Public Function somefunction()
  9. Forms![someform].[somelistbox].SetFocus
  10. Forms![someform].[somelistbox].ListIndex = ind
  11. End Function
  12.  
  13.  
I am not understanding why this will not work so that on an "on_click" routine I can set the list index value to a global variable and call that variable in a public function??? What am I doing wrong here. Thanks in advance you guys/gals.
There is no reason why it should not work if you execute the Click() Event first before calling the Function unless Global ind As Integer is not Declared in a Standard Code Module.
Nov 17 '07 #2
juengelj
12 New Member
There is no reason why it should not work if you execute the Click() Event first before calling the Function unless Global ind As Integer is not Declared in a Standard Code Module.
Thanks, ADezii... I can see that I have 3 different options for modules... Module, Class Module & Procedure... I am using the "Module" one. Is this a "Standard Code Module"?
Nov 17 '07 #3
ADezii
8,834 Recognized Expert Expert
Thanks, ADezii... I can see that I have 3 different options for modules... Module, Class Module & Procedure... I am using the "Module" one. Is this a "Standard Code Module"?
Yes, what you are looking for is a Standard Code Module, not a Class Module, and not a Form or Report Module.
Nov 18 '07 #4

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

Similar topics

10
2532
by: Rigga | last post by:
Hi, Ok first please bear with me as I am a total Python n00b.. Can anyone explain why this does not like me using % FileLoc in the os.system call??? #!/usr/bin/python import sys import os
0
1500
by: Josh Nikle | last post by:
I just realized that I posted this earlier with no title. Sorry. Here's the original post: I have a form with a combo box on it that, when a selection is made, fills in several other controls on the form. The data list for this combo box can be updated via another pop-up form. When I close this pop-up form, I requery the combo box to...
15
12107
by: Lauren Wilson | last post by:
Access 2K dim MyStr as string What is the maximum amount of text or bytes that this variable can store? Does anyone know?
5
7540
by: Jonesgj | last post by:
Hi, I have loaded a listbox with items from a database. I now want to allow the user to re-order the list box manually using up down buttons, before submitting his changes to back to the database. I did this sometime ago in classic vb, and I think I used the Listindex property to check ... anyway, can anyone help? Thanks in anticipation
1
1740
by: WEM | last post by:
I filling a combo box with all 50 states and when I select a customer from a list box I want to find the identity(listindex) in the combo box which is the identity stored in the customer record. If I do not sort the states combo box I'm able to find the correct state(listindex) everytime but if I sort the combo box in ascending order it is not...
1
8401
by: andrew.panin | last post by:
Hi there! I've got a trouble with these things. What's going on? 1ST STEP: we have ListBox item. Let's call it ListBox1. We're adding four values to it using AddItem method: ListBox1.AddItem('a') ListBox1.AddItem('b') ListBox1.AddItem('c') ListBox1.AddItem('d')
4
1928
by: sparks | last post by:
We have a new project here, one that I have never tried maybe its easy I don't know yet. We have people that have records dating back over 5 yrs on a sql server. We have to build an access 2003 database for data entry of the people then pull data from the sql server to fill in data for these records. that sounds good....except to start I...
10
42881
by: Ken OHanlon | last post by:
I have read everything I can find on the internet, BUT it doesn't help! I'm using Windows XP and Access 2003. The following code does increment the listindex as wanted but then after coming back from Private Sub Combo AfterUpdate() zeros it out. You need line one to stop the 7777 error. In addition, line three fires the Private Sub Combo...
4
12133
by: juing | last post by:
Hi All, I am very new in the VBA coding and I've noticed this (to me strange) behavior: Assume this code for "Value Items" type of single select two column ListBox: 1) If List98.ListIndex > -1 Then List98.Selected(List98.ListIndex) = False End If 2)
0
7912
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, 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...
0
8202
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
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...
1
7959
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...
0
8216
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...
0
6614
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...
0
3837
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...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1180
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...

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.