Hello again,
Without seeing what you are doing I can only explain in the blind. So I
will start by synchronizing with your stored procedure. Here is a
typical stored procedure in Sql Server (2000)
-------------------------------------------------
CREATE PROCEDURE [stp_PullZipcodeMilageData]
As
Select * From tblZipcodeMilage --your table in Sql Server
Go
-------------------------------------------------
And here is how you call the SP from an Access Module. First, Make sure
that you have the exact same table in Access, empty of course. The
easiest way to get the exact same table into Access is to export it from
Sql Server using DTS. Actually, this is the easiest way to pass the
data to Access. But I assume you want to automate this since the table
continues to grow. So now you have a table in Sql Server and the Exact
same table in Access. Note: In the Access table you can add one
additional field to the very end of the table where you will eventually
store your Milage data from the 2 zipcodes.
Here is a Sub to populate your Access Table with the Sql Server SP.
Make sure you have a reference to Mdac2.6 in Tools/References (in any
code module in Access). Make sure you have Mdac2.5 and 2.6 loaded on
your calling computer (need Mdac2.5 because it has the Jet interface for
Access - Mdac2.6 does not but has an upgraded ADO interface).
Sup GetZipcodeMilageData()
Dim cmd As New ADODB.Command, RSado As New ADODB.Recordset
Dim RSdao As DAO.Recordset
Dim i As Integer, j As Integer, RetVal As Variant
DoCmd.SetWarnings False
'empty out Access table first
DoCmd.RunSql "Delete * From tblZipCodeMilage"
cmd.ActiveConnection = Provider=SQLOLEDB;Data Source=yourServer;Initial
Catalog=yourSqlDB;UID=SA;PWD=;"
cmd.CommandTimeout = 60 'One minute - plenty of time for sp
cmd.CommandText = "stp_PullZipcodeMilageData"
Set RSado = cmd.Execute
DoEvents
Do While Not RSado.EOF
RSdao.AddNew
For i = 0 To RSado.Fields.Count - 1
RSdao(i) = RSado(i)
Next
RSdao.Update
RSado.MoveNext
j = j + 1
RetVal = SysCmd(acSysCmdSetStatus, j) 'monitor progress
Loop
RSado.Close
RSdao.Close
cmd.ActiveConnection.Close
End Sub
Now you have your Sql Server Data in Access. So now you can easily
manipulate this data in Access. You could actually do this in Sql
Server with a UDF (user Defined Function) and just pull the results from
the UDF (if you want to go there).
I assume your zipcode API is some custom function written in C. So you
make your API declaration and apply it like this where you supply the
arguments for your API function:
Sub UpdateZipCodeMilage()
DoCmd.RunSql "Update tblZipcodeMilage Set Milage =
yourAPIfunction(Zipcode1, Zipcode2)"
End Sub
Depending on how many records you have, say, 50,000, this should take a
few seconds. If you have say 5000 records or less, should take a few
miliseconds.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!