Advertisement
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.
Your Input Matters 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! |
||
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
|