|
|
Find the closest Matched Record
Wild card look up's. I want the user to be able to enter a number or part of
a number and the system to find the first match or if it can't find a match
to find the next one that is close.
Can this be done. Below is my current code that works great if you have the
exact number.
Thanks
Matt
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Private Sub LookUpSerialNo_AfterUpdate()
' Find the record that matches the control.
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.LookUpSerialNo.Value
stLinkCriteria = "[SerialNum]=" & "'" & SID & "'"
'Check table for for item number.
If DCount("SerialNum", "Location", stLinkCriteria) >= 1 Then
'Go to record of original Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
--
Matt Campbell
mattc (at) saunatec [dot] com
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
mattc66
|
3/14/2007 11:24:54 PM |
|
With numeric fields, you can identify the nearest match by sorting on the
smallest absolute difference, e.g.:
ELookup("SerialNum", "Location",, "Abs([SerialNum] - " & [Text99] & ")
DESC")
where ELookup() is:
http://allenbrowne.com/ser-42.html
With Text fields, you will need to be clear in your own mind about what
"neartest match" means. Val() would work if the text is all digits. Text
matching might work if the field is always a fixed number of characters, or
you may need to add leading or trailing spaces if it is not.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"mattc66 via AccessMonster.com" <u16013@uwe> wrote in message
news:6f30a29da0ff4@uwe...
> Wild card look up's. I want the user to be able to enter a number or part
> of
> a number and the system to find the first match or if it can't find a
> match
> to find the next one that is close.
>
> Can this be done. Below is my current code that works great if you have
> the
> exact number.
>
> Thanks
> Matt
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Private Sub LookUpSerialNo_AfterUpdate()
> ' Find the record that matches the control.
> Dim SID As String
> Dim stLinkCriteria As String
> Dim rsc As DAO.Recordset
>
> Set rsc = Me.RecordsetClone
>
> SID = Me.LookUpSerialNo.Value
> stLinkCriteria = "[SerialNum]=" & "'" & SID & "'"
>
> 'Check table for for item number.
> If DCount("SerialNum", "Location", stLinkCriteria) >= 1 Then
> 'Go to record of original Number
> rsc.FindFirst stLinkCriteria
> Me.Bookmark = rsc.Bookmark
>
> End If
> Set rsc = Nothing
> End Sub
>
> --
> Matt Campbell
> mattc (at) saunatec [dot] com
>
> Message posted via http://www.accessmonster.com
>
|
|
0
|
|
|
|
Reply
|
Allen
|
3/15/2007 2:24:37 AM
|
|
|
1 Replies
377 Views
(page loaded in 0.463 seconds)
Similiar Articles: How can i create a query on text input to return closest match ...Can you explain what you mean by closest match? Looking for the word Drink in a field and returning all the records where "drink" is included in the field would be ... VBA Question - find closest next number - microsoft.public.access ...Find the closest Matched Record - microsoft.public.access ... I want the user to be able to enter a number or part of a number and the system to find the ... check table for record - microsoft.public.access.formscoding ...Checking for matching record in MySQL table We can just check MySql table to verify whether a record exist or not. Here we are not interested in collecting the actual ... Lookup value based on nearest date - microsoft.public.access ...... then another table where each record has a date in it, and I need to find the Value from Rates at the matching date ... Excel - Find The Closest Date Based On 2 Variables ... Full And Partial Matching - microsoft.public.access.queries ...Find a record based on field on other form using primary key ..... control where I ... How can i create a query on text input to return closest match ... ... Index, match, multiple IFs query - microsoft.public.excel ...Conditional formatting based on matching record in ... query on text input to return closest match ... ... and Match Function Use Excel INDEX and MATCH functions to find ... Date Search - microsoft.public.word.docmanagement... 9]{1,2}/[0-9]{4} with Use wildcards enabled, should find any date matching that ... I want to be able to query a date field with the result being the record closest to ... Can I build a calendar from a query? - microsoft.public.access ...I use the discussion groups constantly and find this website very helpful! ... I am trying to build a query in Access 2007 that will display all records that fall ... How do I turn on Autocomplete in Access 2003 Forms? - microsoft ...The closest there is is the Auto Expand property of a combo box which moves to the first row matching what has been typed in for ... RQuestion on Form Record Selector Bar ... Excel 2007 Chart colorindex? - microsoft.public.excel.programming ...... of the other), In Excel 2003 record a macro ... Relate the 18 cell patterns to the best match shape patterns (will find ... These > appear to be the closest approximations ... sql - Find closest numeric value in database - Stack OverflowI need to find a select statement that will return either a record that matches my input exactly, or the closest match if an exact match is not found. Microsoft: Office - Excel 2007 Find closest match in multiple recordsTalk With Other Members; Be Notified Of Responses To Your Posts; Keyword Search; One-Click Access To Your Favorite Forums; Automated Signatures On Your Posts How to locate a value or closest match in a Visual FoxPro table ...When NEAR is on, the record pointer in the VFP table is positioned at the closest matching record after an unsuccessful SEEK. The following VB .NET code ... MySQL :: Closest MatchIs it possible in SQL to find a 'closest match' with a set of numbers? eg I have a db with fields R, G & B then I have values r, g & b and I want to find the record that is ... Finding Records in a Recordset Object - Microsoft Corporation ...Do While Not .EOF Debug.Print .Fields(strDisplayField).Value ' Skip the current record and find next match. . 7/20/2012 9:01:22 PM
|
|
|
|
|
|
|
|
|