Advertisement

03.06.2008 at 01:19AM PST, ID: 23218844
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

List Box control: works in Access 2003, but not in Access 2000

Asked by Annu in Access Forms, Visual Basic Programming

Tags:

I am trying to get Postcode Anywhere (www.postcodeanywhere.co.uk) address lookup working on my Access 2000 Form.

They have supplied a sample Form which has a some address fields, a find button and a List Box. You type the postcode in the Postcode text box and click Find. The code then populates the List Box, from which you can double click any item to fill in yoour own Form's address fields.

All the VBA code behind the sample Form is below.

When I use this code on my development machine which has Access 2003, everything works fine. But on my clients machine which has Access 2000, I get this error for RemoveItem (0):

line 13: lstWorker.RemoveItem (0)

Compile error: Method or data member not found

I suspect that I may get the same error for lstWorker.AddItem, etc.

Can you help me solve this problem? Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
Option Compare Database
 
Dim rstList As Object
 
Const ACCOUNT_CODE As String = "usernamexxx"
Const LICENSE_KEY As String = "Dxxx-xxxx-xxxx-xxx3"
 
Private Sub btnFind_Click()
    
    'First clear the current list
    numItems = lstWorker.ListCount - 1
    For i = 0 To numItems
        lstWorker.RemoveItem (0)
    Next
    
    'Start the query
    Set rstList = CreateObject("ADODB.Recordset")
    rstList.Open "http://services.postcodeanywhere.co.uk/recordset.aspx?account_code=" & ACCOUNT_CODE & "&license_key=" & LICENSE_KEY & "&action=lookup&type=by_postcode&postcode=" & Postcode
    
    'Check for an error
    If rstList.Fields.Count = 2 Then
        MsgBox rstList.Fields(1)
        Exit Sub
    End If
    
    'Copy the data into the list box
    While Not rstList.EOF
        lstWorker.AddItem (rstList.Fields("description"))
        rstList.MoveNext
    Wend
 
End Sub
 
Private Sub lstWorker_DblClick2(Cancel As Integer)
 
    'Drill down / get the address
    'DoSelect
    
End Sub
 
Public Sub DoSelect()
 
    Dim strUrl As String
    Dim i As Integer
    Dim numItems As Integer
 
    'numItems = lstItems.ListCount - 1
    numItems = lstWorker.ListCount - 1
    For i = 0 To numItems
        'lstItems.RemoveItem (0)
        lstWorker.RemoveItem (0)
    Next
    
    'Build the URL
    strUrl = "http://services.postcodeanywhere.co.uk/recordset.aspx?"
    strUrl = strUrl & "account_code=" & ACCOUNT_CODE
    strUrl = strUrl & "&license_code=" & LICENSE_KEY
    strUrl = strUrl & "&action=lookup&type=by_postcode"
    strUrl = strUrl & "&postcode=" & Postcode
 
    'Get the data from Postcode Anywhere
    Set rstList = CreateObject("adodb.recordset")
    rstList.Open strUrl
    
    'Check for an error
    If rstList.Fields.Count = 2 Then
        MsgBox rstList.Fields(1)
        Exit Sub
    End If
    
    'Copy the data into the list box
    While Not rstList.EOF
        'lstItems.AddItem (rstList.Fields("description"))
        lstWorker.AddItem (rstList.Fields("description"))
        rstList.MoveNext
    Wend
End Sub
 
Private Sub lstWorker_DblClick(Cancel As Integer)
On Error GoTo err:
 
    'Dim rst As Object
    Dim strId As String
    Dim strUrl As String
    
    'Get the id of the item
    rstList.MoveFirst
    rstList.Move lstWorker.ListIndex
    strId = rstList.Fields("id")
    
    'Build the URL
    strUrl = "http://services.postcodeanywhere.co.uk/recordset.aspx?"
    strUrl = strUrl & "account_code=" & ACCOUNT_CODE
    strUrl = strUrl & "&license_code=" & LICENSE_KEY
    strUrl = strUrl & "&action=fetch"
    strUrl = strUrl & "&id=" & strId
    
    'Get the data from postcode anywhere
    Dim rstFetch As Object
    Set rstFetch = CreateObject("adodb.recordset")
    rstFetch.Open strUrl
    
    'Check for an error
    If rstFetch.Fields.Count = 2 Then
        MsgBox rstFetch.Fields(1)
        Exit Sub
    End If
    
    'Copy the data into the list box
    If Not rstFetch.EOF Then
        Me.Company = rstFetch.Fields("organisation_name")
        Me.Address1 = rstFetch.Fields("line1")
        Me.Address2 = rstFetch.Fields("line2")
        Me.Address3 = rstFetch.Fields("line3")
        'Me.Address4 = rstFetch.Fields("line4")
        Me.Town = rstFetch.Fields("post_town")
        Me.County = rstFetch.Fields("county")
        Me.Postcode = rstFetch.Fields("postcode")
    End If
    
    Exit Sub
    
err:
    
    Exit Sub
 
End Sub
 
 
 
Private Sub DrawList()
 
    If rstList.Fields.Count = 2 Then
        MsgBox rstList.Fields(1)
        Exit Sub
    End If
    
    'Update the control
    'Set Me.lstWorker.Recordset = rstList
    'Me.lstWorker.ColumnCount = 3
    'Me.lstWorker.ColumnWidths = "0;0;"
    'Me.lstWorker.BoundColumn = 1
    'Me.lstWorker.Requery
    
End Sub
[+][-]03.06.2008 at 03:04AM PST, ID: 21058998

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 04:36AM PST, ID: 21059500

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 04:50AM PST, ID: 21059606

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 05:21AM PST, ID: 21059835

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 05:55AM PST, ID: 21060118

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 06:54AM PST, ID: 21060666

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 08:36AM PST, ID: 21061995

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:24AM PST, ID: 21062599

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:31AM PST, ID: 21062687

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:43AM PST, ID: 21062810

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:48AM PST, ID: 21062851

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:52AM PST, ID: 21062899

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.08.2008 at 12:47AM PST, ID: 21076356

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2008 at 12:56AM PST, ID: 21076376

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2008 at 07:27AM PST, ID: 21077254

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.08.2008 at 12:51PM PST, ID: 21078583

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 03:07AM PDT, ID: 21085085

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 04:34AM PDT, ID: 21085415

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 05:00AM PDT, ID: 21085546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 05:42AM PDT, ID: 21085775

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 11:00AM PDT, ID: 21088638

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 11:45AM PDT, ID: 21089031

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 11:46AM PDT, ID: 21089042

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 01:45PM PDT, ID: 21090230

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, Visual Basic Programming
Tags: VBA
Sign Up Now!
Solution Provided By: GrahamSkan
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.12.2008 at 09:07AM PDT, ID: 21107472

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628