QAS Pro Postcode Validation Problems

Jonny462

New member
Local time
Today, 21:56
Joined
Aug 19, 2013
Messages
3
Hey Everyone

I recently got employed in a local call centre. One of my first tasks is to fix the problems with the postcode validation. They have been running a QAS Pro 6.74 server for near 2 years now. It appears to work, however certain postcodes bring back the wrong address.

The person I replaced wrote a reference DLL to link access to the QAS server (hosted internally). Its based on the sample code QAS provide and is written in C#. We only use the one-line function to get a full address from the postcode. For this access needs to use 2 different functions. The first returns a combo box of possible address and when selected the second function will format the address, send it back to access and have it appended in the correct fields.

An example of the address problems.

If I enter the postcode: PA16 9AE.
It will give a list of address, such as: 0/3 15 Brachelston Street, GREENOCK, Renfrewshire

When I select any address with a forward slash in it, I always get back:
1 Crossgates, Greenock Road, BISHOPTON, Renfrewshire

I have been working on this for over 2 weeks now with no success. I've exhausted every forum and Google search I can. I'm new to C# so my knowledge is limited. If anyone has got this working and could assist I would greatly appreciate it.

If I missed any code, let me know. Theres quite a bit pulled into the reference, so I didn't want to post all.

The C# code to interact with the server:

Code:
        public QAS()
        {
            QuickAddress address = new QuickAddress("[Link to server]") {
                Engine = QuickAddress.EngineTypes.Singleline,
                Flatten = true
            };
            this.searchService = address;
        }

        private string GetMoniker(string p)
        {
            return this.searchService.Search("GBR", p, PromptSet.Types.OneLine, "Database layout").Picklist.Items[0].Moniker;
        }

        public string[] RefinePostcode(string p)
        {
            string moniker = this.GetMoniker(p);
            FormattedAddress formattedAddress = this.searchService.GetFormattedAddress(moniker, "Database Layout");
            return new string[] { formattedAddress.AddressLines[0].Line, formattedAddress.AddressLines[1].Line, formattedAddress.AddressLines[2].Line, formattedAddress.AddressLines[3].Line, formattedAddress.AddressLines[4].Line, formattedAddress.AddressLines[5].Line, formattedAddress.AddressLines[6].Line };
        }

        public string[] SearchPostcodes(string postCode)
        {
            SearchResult result = this.searchService.Search("GBR", postCode, PromptSet.Types.OneLine, "Database layout");
            string[] strArray = new string[result.Picklist.Length];
            for (int i = 0; i < result.Picklist.Length; i++)
            {
                strArray[i] = result.Picklist.Items[i].Text;
            }
            return strArray;
        }

The Access code to communicate with the reference:

Code:
Private Sub cmdSelect_Click()

    Dim thisOne As String
    thisOne = Me.lkupAddressList.Value
    
    Dim objQAS As MangoQAS.QAS
    Set objQAS = New MangoQAS.QAS
    Dim finalAddress As Variant
    
    finalAddress = objQAS.RefinePostcode(thisOne)

    Form_Script.txtAddress1 = finalAddress(0)
    Form_Script.txtAddress2 = finalAddress(1)
    Form_Script.txtAddress3 = finalAddress(2)
    Form_Script.txtTown = finalAddress(3)
    Form_Script.txtCounty = finalAddress(4)
    Form_Script.txtPostcode = finalAddress(5)
    
    Set objQAS = Nothing
    
    DoCmd.Close acForm, "frmSelectAddress_qas"

End Sub

Private Sub Form_Load()

    Dim postcodeToSearch As String
    
    postcodeToSearch = Form_Script.txtPostcode
    
    Dim objQAS As MangoQAS.QAS
    Set objQAS = New MangoQAS.QAS
    Dim results As Variant
    
    results = objQAS.SearchPostcodes(postcodeToSearch)
    
    Dim howMany As Integer
    howMany = UBound(results)
    
    For i = 0 To howMany
        Me.lkupAddressList.AddItem ("'" & results(i) & "'")
    Next
    
    Set objQAS = Nothing

End Sub
 
I know you are more comfortable using the Code above, I am not experienced with C# so my knowledge is limited, but I can offer you an alternative.. Postcode Lookup.. I use that in my application.. Works good for me..
 
Thanks for the reply pr2-eugin.

I have no problems changing to a solution like that, but its my companies choice to use QAS and I their not up for changing.

The QAS system will be used for a system called callscripter that is in the process of being setup to replace access. That will take another 4-6 months to implement, so access needs fixed before then.

Thanks
Jonathan
 

Users who are viewing this thread

Back
Top Bottom