2680 Sikh Philosophy Network - View Single Post - Search/Find Record dlookup
View Single Post
  #2 (permalink)  
Old 28-Jul-2006, 08:13 AM
Dirk Goldgar's Avatar Dirk Goldgar
Guest
 
Posts: n/a
   
   
Re: Search/Find Record dlookup

"lmv" wrote in message
news:58230150-E262-45D4-9276-FE4BBC463F73@microsoft.com
> I am using the FIND code below and it works well on all but the
> "requestedby" (which is a combo box which is viewed as a name but
> stored as a number.) SELECT DISTINCT Overseer.OverseerID,
> Overseer.LastName, Overseer.FirstName, Overseer.Department FROM
> Overseer WHERE (((Overseer.LastName) Is Not Null)) ORDER BY
> Overseer.LastName, Overseer.Department;
>
> I want to be able to search in this code by the name. I tried the
> following after the first error handler. I don't know where it should
> go (I get error 2001, previous ... xceled)
>
> 'lookup value for "requestedby"
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10461-search-find-record-dlookup.html
> RequestedBy = DLookup("[LastName]", "Overseer", "[OverseerID]='" &
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10461
> Forms!OrdersWDetails!RequestedBy & "'")
>
> Thanks in advance!
> lmv
>
> '--------FIND CODE---------
> Private Sub FindRecordLike(strFindMode As String)
> 'Copyright 2003 J Street Technology, Inc.
> 'www.JStreetTech.com
> 'May be used and distributed without permission if these 3 lines are
> included. On Error GoTo Error_Handler
>
> 'PO number shows up in search additional fields show up as ID
> numbers Call jst_FindRecord(frmCallingForm:=Me, _
> ctlFindFirst:=Me!cmdFirst, _
> ctlFindNext:=Me!cmdNext, _
> ctlSearchText:=Me!txtFind, _
> ctlSearchOption:=Me!optFind, _
> strFindMode:=strFindMode, _
> strField1:="ProjectID", _
> strField2:="PurchaseOrderNumber", _
> strField3:="RequestedBy")
>
> Exit_Procedure:
> Exit Sub
> Error_Handler:
> MsgBox Err.Number & ", " & Err.Description
> Resume Exit_Procedure
> Resume
> End Sub


I can't make much of the FindRecordLike() and (unposted)
jst_FindRecord() routines, but if your OverseerID field is a number, and
the combo box RequestedBy has a numeric ID field as its bound column,
then your DLookup should drop the quotes around the value:

RequestedBy = DLookup("[LastName]", "Overseer", _
"[OverseerID]=" & Forms!OrdersWDetails!RequestedBy)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Reply With Quote
 
Page generated in 0.18095 seconds with 25 queries
0