Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Me.Recordset = rst thinks its a field??

Status
Not open for further replies.

SeanB

Programmer
Jul 19, 2001
70
US
My form when I am trying to set the Form Recordset gives me an error can't find field recordset. Why would this happen? I think I have everything right I am dim a new recordset and all that??
 
Dim strsql As String
Dim rst As New ADODB.Recordset

strsql = &quot;SELECT tblCustomer.PoRef1,tblCustomer.PoRef2,tblCustomer.AdminComments,tblCustomer.DispatchComments,tblCustomer.CustCode, tblCustomer.StateLocation, tblOrderStatusCodes.OrderStatusOrder As StatusCode,tblcustomer.custid as CustCustID,t.*,case when t.OrderDate<convert(varchar(11),getdate(),113) then 2 else case&quot; & _
&quot; when t.OrderDate>convert(varchar(11),getdate(),113) then 3 else 1 end end AS ColorID &quot; & _
&quot; FROM tblOrders As t INNER JOIN tblCustomer ON t.CustID = tblCustomer.CustID INNER JOIN tblOrderStatusCodes ON t.OrderStatusCode = tblOrderStatusCodes.OrderStatusCode &quot; & _
&quot; WHERE t.OrderStatusCode In ('AA','AD','AP','AS','RR','CB','PB','RB','HD') AND t.PickUpDate < getdate() AND tblCustomer.StateLocation IN (Select State from tblUserStateFilter where SessionID = &quot; & Trim(gSessionID) & &quot;)&quot; & _
&quot; ORDER BY StatusCode, t.OrderStatusCode, t.PickupDate, t.VehicleType, t.PickupTime , t.OrderNumber &quot;

rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
rst.Open strsql
DoCmd.Echo False
Set Me.Recordset = rst
DoCmd.Echo True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top