Problem with sql statement in ADODB recordset

Prysson

Registered User.
Local time
Today, 21:42
Joined
Sep 23, 2002
Messages
45
I have the following code in my module

Dim rsVineyard As ADODB.Recordset
Dim mySQLVineyard As String

mySQLVineyard = "SELECT tblVineyard.VineyardName FROM tblVineyard WHERE (((tblVineyard.VineyardName)<>'na'));"



Set rsVineyard = New ADODB.Recordset
With rsVineyard
.ActiveConnection = CurrentProject.Connection
.CursorLocation = adUseServer
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open mySQLVineyard
End With

Close


When I try to run this and use the ?rsVineyard.Fields("VineyardName") int he immediate window it says it can not find the corresponding records.

I am assuming that my sql statement is not correct.

Could someone help me out with a suggested sql statement here?
 
The code looks fine and it worked for me. I'm assuming you've enclosed this within a Sub or Function, right?
 
I actually figured it out..I just wasnt stopping the function to check the data in the recordset
 

Users who are viewing this thread

Back
Top Bottom