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!

Looking for a matching record in a table 1

Status
Not open for further replies.

teriwinkle

Technical User
Oct 29, 2003
7
US
I have been struggling with the following problem. I have a table of forecasted parts (tblForecast), separate from my partnumber table (PartNumbers). When I add a partnumber to a form in my database, I want to be able to check to see if it is in the forecasted parts table automatically. If it is, I want a check box on the form to be checked. I have tried the following, but it is not working for me. Am I approaching this correctly? Can anyone think of a better way? Thanks for your help! ___________________________________________--

Dim Forecasted As Boolean

If DLookup("[PartNo]", "tblForecastParts", "[PartNo] = Forms![PartNumbers]![PartNo]") Then _


Forecasted = "Yes"
End If


 
The "DLookUp" will return either the Part Number (if found) or NULL if it isn't. You could do something like
Code:
ForeCasted = NOT IsNull(DLookup("[PartNo]", "tblForecastParts", "[PartNo] = Forms![PartNumbers]![PartNo]"))
 
Thank you for the help. It is working for me now with the format you suggested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top