M
Maracay
Hi guys,
The Iam using the code below to search the Canadian province or the USA
state, the full name or the abbreviation (Texas or TX) both are in ProvState
field, CountryID=0 is Canada, the problem is that ProvState is not been
recognized, qryProvState is a query I created, I will really appreciated if
someone has any idea of what the problem is.
Thanks
Function AllPronvices(CanProvince, nCountryID)
On Error GoTo Err_handler
Dim strCanProv As String
Dim db As DAO.Database
Dim rs As Recordset
Dim rsa As DAO.Recordset
Set rs = Me.RecordsetClone
Set db = CurrentDb
Set rsa = db.OpenRecordset("qryProvState", dbOpenDynaset)
rsa.MoveFirst
Do Until rsa.EOF
If nCountryID = 0 And (rsa!ProvState = CanProvince) Then
AllPronvices = rsa!countryID
Exit Function
End If
rsa.MoveNext
Loop
AllPronvices = False
sExit:
rsa.Close
Set rsa = Nothing
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Function
Err_handler:
MsgBox Err.Description
Resume sExit
End Function
The Iam using the code below to search the Canadian province or the USA
state, the full name or the abbreviation (Texas or TX) both are in ProvState
field, CountryID=0 is Canada, the problem is that ProvState is not been
recognized, qryProvState is a query I created, I will really appreciated if
someone has any idea of what the problem is.
Thanks
Function AllPronvices(CanProvince, nCountryID)
On Error GoTo Err_handler
Dim strCanProv As String
Dim db As DAO.Database
Dim rs As Recordset
Dim rsa As DAO.Recordset
Set rs = Me.RecordsetClone
Set db = CurrentDb
Set rsa = db.OpenRecordset("qryProvState", dbOpenDynaset)
rsa.MoveFirst
Do Until rsa.EOF
If nCountryID = 0 And (rsa!ProvState = CanProvince) Then
AllPronvices = rsa!countryID
Exit Function
End If
rsa.MoveNext
Loop
AllPronvices = False
sExit:
rsa.Close
Set rsa = Nothing
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Function
Err_handler:
MsgBox Err.Description
Resume sExit
End Function