473,325 Members | 2,608 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,325 software developers and data experts.

ListIndex as Variable?? Access 2003, XP

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 2585
ADezii
8,834 Expert 8TB
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
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 Expert 8TB
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
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
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...
15
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
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...
1
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...
1
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:...
4
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...
10
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...
4
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.