Query field not been recognized

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
 
M

Maracay

Unbelievable, I didn’t have ProvState on my query, and I checked so many times.

Thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top