474,046 Members | 6,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

load list box function bug

Hi,
In our company we use Access 2000 as a "thin client" getting all
of our information from a SQL Server database. We use a custom
function to populate list and combo boxes which, for some records, is
returning some wierd results. If their is a ampersand and a space in a
name returned into the array that populates the list box, the list box
appears to be doubling the text, i.e, "T&est Company" will show up as
"T&est CompanTyest Company" in the list box. I was wondering if anyone
had encountered this problem in the past since I can't seem to find
any similar posts.

Access 2000 version: 9.0.3821 SR-1

Thanks for your time,

Brad Hood

The simplified code is below:

Create a Form and add a list box called: lstCompany
Paste in the Form Load sub: lstCompany.RowS ourceType = "LoadListBo xes"

create a new module and paste in the following code:

Public Function LoadListBoxes(c tl As Control, id As Variant, _
row As Long, col As Long, code As Integer) As Variant
Static vReturn As Variant
Static iCount As Integer
Static iCompanyCount As Integer
Static CompanyArray() As String
Dim i As Integer
Select Case code
Case acLBInitialize
Select Case ctl.Name
Case "lstCompany "
ReDim CompanyArray(0)
CompanyArray(i) = "T&est Company"
i = i + 1
iCompanyCount = i
vReturn = i
End Select
Case acLBOpen
vReturn = Timer
Case acLBGetRowCount
Select Case ctl.Name
Case "lstCompany "
vReturn = iCompanyCount
End Select
Case acLBGetColumnCo unt
vReturn = 1
Case acLBGetColumnWi dth
vReturn = True
Case acLBGetValue
Select Case ctl.Name
Case "lstCompany "
vReturn = CompanyArray(ro w)
End Select
Case acLBEnd
Select Case ctl.Name
Case "lstExistingCom panies"
Erase CompanyArray
iCompanyCount = 0
End Select
End Select
LoadListBoxes = vReturn
End Function
Nov 12 '05 #1
2 2108
Brad,

Rather than "Static vReturn As Variant"
Try "Dim vReturn As Variant"

For correctness, you may also want to look at the lines:
Case acLBEnd
Select Case ctl.Name
Case "lstExistingCom panies" <<<<<

Looks like you wanted:
Case "lstCompany "

-dp

Sp*******@msn.c om (Brad Hood) wrote in message news:<56******* *************** ***@posting.goo gle.com>...
Hi,
In our company we use Access 2000 as a "thin client" getting all
of our information from a SQL Server database. We use a custom
function to populate list and combo boxes which, for some records, is
returning some wierd results. If their is a ampersand and a space in a
name returned into the array that populates the list box, the list box
appears to be doubling the text, i.e, "T&est Company" will show up as
"T&est CompanTyest Company" in the list box. I was wondering if anyone
had encountered this problem in the past since I can't seem to find
any similar posts.

Access 2000 version: 9.0.3821 SR-1

Thanks for your time,

Brad Hood

The simplified code is below:

Create a Form and add a list box called: lstCompany
Paste in the Form Load sub: lstCompany.RowS ourceType = "LoadListBo xes"

create a new module and paste in the following code:

Public Function LoadListBoxes(c tl As Control, id As Variant, _
row As Long, col As Long, code As Integer) As Variant
Static vReturn As Variant
Static iCount As Integer
Static iCompanyCount As Integer
Static CompanyArray() As String
Dim i As Integer
Select Case code
Case acLBInitialize
Select Case ctl.Name
Case "lstCompany "
ReDim CompanyArray(0)
CompanyArray(i) = "T&est Company"
i = i + 1
iCompanyCount = i
vReturn = i
End Select
Case acLBOpen
vReturn = Timer
Case acLBGetRowCount
Select Case ctl.Name
Case "lstCompany "
vReturn = iCompanyCount
End Select
Case acLBGetColumnCo unt
vReturn = 1
Case acLBGetColumnWi dth
vReturn = True
Case acLBGetValue
Select Case ctl.Name
Case "lstCompany "
vReturn = CompanyArray(ro w)
End Select
Case acLBEnd
Select Case ctl.Name
Case "lstExistingCom panies"
Erase CompanyArray
iCompanyCount = 0
End Select
End Select
LoadListBoxes = vReturn
End Function

Nov 12 '05 #2
Thanks. The dim declaration did the trick. Maybe someone should let
microsoft now about this in their "Creating Combo Boxes and List Boxes
in Microsoft Access" article :)

http://www.microsoft.com/accessdev/articles/combo.htm

dp****@app-tech.com (Dave Perry) wrote in message news:<a0******* *************** ****@posting.go ogle.com>...
Brad,

Rather than "Static vReturn As Variant"
Try "Dim vReturn As Variant"

For correctness, you may also want to look at the lines:
Case acLBEnd
Select Case ctl.Name
Case "lstExistingCom panies" <<<<<

Looks like you wanted:
Case "lstCompany "

-dp

Sp*******@msn.c om (Brad Hood) wrote in message news:<56******* *************** ***@posting.goo gle.com>...
Hi,
In our company we use Access 2000 as a "thin client" getting all
of our information from a SQL Server database. We use a custom
function to populate list and combo boxes which, for some records, is
returning some wierd results. If their is a ampersand and a space in a
name returned into the array that populates the list box, the list box
appears to be doubling the text, i.e, "T&est Company" will show up as
"T&est CompanTyest Company" in the list box. I was wondering if anyone
had encountered this problem in the past since I can't seem to find
any similar posts.

Access 2000 version: 9.0.3821 SR-1

Thanks for your time,

Brad Hood

The simplified code is below:

Create a Form and add a list box called: lstCompany
Paste in the Form Load sub: lstCompany.RowS ourceType = "LoadListBo xes"

create a new module and paste in the following code:

Public Function LoadListBoxes(c tl As Control, id As Variant, _
row As Long, col As Long, code As Integer) As Variant
Static vReturn As Variant
Static iCount As Integer
Static iCompanyCount As Integer
Static CompanyArray() As String
Dim i As Integer
Select Case code
Case acLBInitialize
Select Case ctl.Name
Case "lstCompany "
ReDim CompanyArray(0)
CompanyArray(i) = "T&est Company"
i = i + 1
iCompanyCount = i
vReturn = i
End Select
Case acLBOpen
vReturn = Timer
Case acLBGetRowCount
Select Case ctl.Name
Case "lstCompany "
vReturn = iCompanyCount
End Select
Case acLBGetColumnCo unt
vReturn = 1
Case acLBGetColumnWi dth
vReturn = True
Case acLBGetValue
Select Case ctl.Name
Case "lstCompany "
vReturn = CompanyArray(ro w)
End Select
Case acLBEnd
Select Case ctl.Name
Case "lstExistingCom panies"
Erase CompanyArray
iCompanyCount = 0
End Select
End Select
LoadListBoxes = vReturn
End Function

Nov 12 '05 #3

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

Similar topics

0
6702
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to be able to place the PHP file on the server, and I guess you probably can't do that either. Talk about catch 22... The only other way I can think of is to install MySQL on a machine you control, then import the data there using the method I...
0
4431
by: Peter | last post by:
When I issue call sqlj.install_jar('file:///f:/jars/mail.jar','MAIL'); I get the messages SQL4301N Java or .NET interpreter startup or communication failed, reason
2
409
by: Brad Hood | last post by:
Hi, In our company we use Access 2000 as a "thin client" getting all of our information from a SQL Server database. We use a custom function to populate list and combo boxes which, for some records, is returning some wierd results. If their is a ampersand and a space in a name returned into the array that populates the list box, the list box appears to be doubling the text, i.e, "T&est Company" will show up as "T&est CompanTyest Company"...
9
21663
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
15
10121
by: H00ner | last post by:
Hello All Hope you can help Been pulling my hair out about a popup problem in ASP.NET. One of the forms i wrote requires the user to select a product from a list in a popup web form. the popup has a DataGrid on it and the page.load function DataBinds as you'd expect. I have Code-Behind in C# to emit a call to a JavaScript function which
3
2195
by: gilbert3b2g | last post by:
I'm new to Python, and programming in general. What I'm trying to do here is to load a list of accounts from a file on my harddrive into a string of Buttons in Tkinter, and when I press one of the Buttons, which has one of my account name, it will load that account into a new window. But I don't understand how to code the proccess that would tell the program what account is selected. Any help with this would be very appreciated. Thanks in...
3
2018
by: Ronald S. Cook | last post by:
I lost my last post, but I'm looking for a better way to manage loading user controls (that are essentially forms) in a Windows app. In my current design, I have a ListBar in which the user selects an item. I then call a sub to loop through and remove any user control that may exist in the panel. But then I have a wordy select statement to load up the user control selected. Isn't there a better way?
1
5142
by: jianxin9 | last post by:
Hi, I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the information to load. Any suggestions on how I might get around that. The articles tab is the tab where the javascript won't load. Thanks so much for any help you might be able to provide: This is what the tabs code looks like: <ul...
3
6680
by: Queez | last post by:
Very quick question. I have a master page (M1) and three content pages (C1, C2, C3). In M1, there's a list of three anchors (A1, A2, A3) which point towards the three content pages. The anchors have some CSS to make them look pretty. I'd like to be able to dynamically set the CSS for A1 when I navigate to C1 so it looks slightly different to the other two (e.g. to indicate this is the currently selected item). Below is what I have so...
0
10339
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
11604
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
12031
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,...
1
8700
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
7874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6654
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
6837
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5420
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
3
3974
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.