VB Code:
Function Postage_Charge(Postage As String, Country As String) As Currency
dim strSql as string
strsql="SELECT Postage, Country "
strsql=strsql & "FROM tblPostal "
strsql=strsql & "WHERE [postage]='" & Postage & "' and [country]='" & Country & "'"
Set RecordD = New ADODB.Recordset
RecordD.Open strsql,CurrentProject.Connection,3,3,1 'static, optimistic, adcmdtext
'Return Postal charges plus shipping'
if recordd.eof then
'---- no records returned
else
'---- check your fields...?
Postage_Charge = RecordD.Fields(0).Value + RecordD.Fields
(1).Value
end if
'---- close recordset and clean up
recordd.close
set recordd = nothing
End Function