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

Where clause for a recordset 1

Status
Not open for further replies.

tbac

Technical User
Jun 16, 2003
59
US
Can someone tell me the proper code for putting a "Where" clause onto this:
Dim md As DAO.Recordset
Set md = CurrentDb.OpenRecordset("MDQuarantineShipmentID")

I would like the dataset to include only those records Where MDQuarantineShipmentID!ShipmentID = Me!ShipmentID. And ShipmentID is an Integer.
 

Capture MDQuarantineShipmentID!ShipmentID = Me!ShipmentID
somehow - let's use a text box called txtShipmentID

Change Set md = CurrentDb.OpenRecordset("MDQuarantineShipmentID")
to
Set md = CurrentDb.OpenRecordset("Select * From MDQuarantineShipmentID Where ShipmentID = '" & txtShipmentID & '" & " And IsNumeric('" & txtShipmentID & "') = True")

Haven't tested it, but oughta work...


I have great faith in fools; self-confidence my friends call it.
-Poe
 
How about:

Set md = CurrentDb.OpenRecordset("Select * From MDQuarantineShipmentID Where MDQuarantineShipmentID!ShipmentID =" & Me!ShipmentID)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top