Link to home
Start Free TrialLog in
Avatar of stirnpanzer
stirnpanzer

asked on

Convert VB into lotusscript / XML

I have a "Desktop application" that needs to post a "Zip/Post code" that is validated and return various values.

I want it so the User enters the zip/post code in a field then uses a button to send/receive the data. To a 3rd party validation company.

It can return up to 15 results of :- number,address1,address2,address3,town,county,... per Zip/post code

User then selects one, I want to then post the one selected again to return the exact :- number,address1,address2,address3,town,county,... and from its result populate various address fields.

I have been supplied an example of the code in Visual basic and need to convert it in Lotusscript. Or perhaps into xml ???

See example VB code.


Const ACCOUNTCODE = "AAAAA11111"
Const LICENSEKEY = "AA11-AA11-AA11-AA11"

Dim objRst As Recordset

Private Sub btnFind_Click()

Dim strUrl As String

'Build the URL
strUrl = "http://services.postcodecheck.com/recordset.aspx?"
strUrl = strUrl & "action=lookup"
strUrl = strUrl & "&account_code=" & ACCOUNTCODE
strUrl = strUrl & "&license_code=" & LICENSEKEY
strUrl = strUrl & "&postcode=" & Me.txtPostcode

'Get the data from Postcode Anywhere
Set objRst = New Recordset
objRst.Open strUrl

'Populate the list
lstProperties.Clear
While Not objRst.EOF
lstProperties.AddItem objRst.Fields("description")
objRst.MoveNext
Wend

End Sub

Private Sub Form_Load()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub lblAddress_Click()

End Sub

Private Sub lstProperties_DblClick()

Dim strUrl As String
Dim objRstAddress As Recordset
Dim strLabel As String

'Find the selected item in the recordset to get the id
objRst.MoveFirst
objRst.Move lstProperties.ListIndex

'Build the URL
strUrl = "http://services.postcodecheck.com/recordset.aspx?"
strUrl = strUrl & "action=fetch"
strUrl = strUrl & "&account_code=" & ACCOUNTCODE
strUrl = strUrl & "&license_code=" & LICENSEKEY
strUrl = strUrl & "&id=" & objRst.Fields("id")

'Get the data from Postcode Anywhere
Set objRstAddress = New Recordset
objRstAddress.Open strUrl

'Write the label
strLabel = ""
If objRstAddress.Fields("organisation_name") <> "" Then
strLabel = strLabel & objRstAddress.Fields("organisation_name") & vbCrLf
End If
If objRstAddress.Fields("line1") <> "" Then
strLabel = strLabel & objRstAddress.Fields("line1") & vbCrLf
End If
If objRstAddress.Fields("line2") <> "" Then
strLabel = strLabel & objRstAddress.Fields("line2") & vbCrLf
End If
If objRstAddress.Fields("line3") <> "" Then
strLabel = strLabel & objRstAddress.Fields("line3") & vbCrLf
End If
If objRstAddress.Fields("post_town") <> "" Then
strLabel = strLabel & objRstAddress.Fields("post_town") & vbCrLf
End If
If objRstAddress.Fields("county") <> "" Then
strLabel = strLabel & objRstAddress.Fields("county") & vbCrLf
End If
If objRstAddress.Fields("postcode") <> "" Then
strLabel = strLabel & objRstAddress.Fields("postcode") & vbCrLf
End If
Me.lblAddress.Caption = strLabel


End Sub

Private Sub txtPostcode_Change()

End Sub
ASKER CERTIFIED SOLUTION
Avatar of AndrewJayPollack
AndrewJayPollack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwaletee
qwaletee

Abandoned question?