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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error executing query in code

Status
Not open for further replies.

projecttoday

Programmer
Joined
Feb 28, 2004
Messages
208
Location
US
When I try to run the following query in code with a DLookup I get the error "Undefined function 'Forms.frmReservationslist.lstReservations.Column' in expression." Note the missing column number. These Forms.frm... references should be correct as I set some variables to them in the code as a test. Any idea how to get rid of this error?

SELECT qryItemsmodels.Itemid, qryItemsmodels.Modelid, qryItemsmodels.Name1, qryItemsmodels.Manufacturerid, qryItemsmodels.Iteminout
FROM qryItemsmodels
WHERE (((qryItemsmodels.Itemid) Not In (SELECT tblRentaldetails.Itemid
FROM tblRentaldetails INNER JOIN tblRentals ON tblRentaldetails.Rentalid = tblRentals.Rentalid
WHERE ( tblRentals.Startdateandtime<= Forms.frmreservationslist.lstReservations.Column(2) AND
tblrentals.enddateandtime >= Forms.frmreservationslist.lstReservations.Column(2) AND ( ([tblRentaldetails].[returndateandtime]) Is Null) ) OR
( tblRentals.Startdateandtime<=Forms.frmreservationslist.lstReservations.Column(3) AND
tblrentals.enddateandtime >= Forms.frmreservationslist.lstReservations.Column(3) AND ( ([tblRentaldetails].[returndateandtime]) Is Null) ) OR
( tblRentals.Startdateandtime>=Forms.frmreservationslist.lstReservations.Column(2) AND
tblrentals.enddateandtime <= Forms.frmreservationslist.lstReservations.Column(3) AND ( ([tblRentaldetails].[returndateandtime]) Is Null) ))) AND ((qryItemsmodels.Modelid)=Forms.frmreservationslist.lstReservations.Column(6)));
 
Where is the DLookup?

Computers make very fast, very accurate mistakes.
 
In the on click event of a command button. But I've got it working now hopefully with a recordset so I'm going to go with that, I think. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top