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 = "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" & _
" when t.OrderDate>convert(varchar(11),getdate(),113) then 3 else 1 end end AS ColorID " & _
" FROM tblOrders As t INNER JOIN tblCustomer ON t.CustID = tblCustomer.CustID INNER JOIN tblOrderStatusCodes ON t.OrderStatusCode = tblOrderStatusCodes.OrderStatusCode " & _
" 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 = " & Trim(gSessionID) & "" & _
" ORDER BY StatusCode, t.OrderStatusCode, t.PickupDate, t.VehicleType, t.PickupTime , t.OrderNumber "
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.