Forum Discussion
KakovostMDM
Aug 24, 2022Copper Contributor
Search records by a single field
Hello Is there a possibility of searching through records using only one specific field? Among many others, I have the following 2 fields that are causing me problems: Order ID (with primary k...
- Aug 24, 2022
Hi,
In theory you should be able to set the focus to the ID field and set the OnlyCurrentField parameter of the FindRecord method to True. As that would be too unreliable for me, I wouldn't use that but sth like:
Docmd.OpenForm "YourForm", , , "[Order Id]=" & YourSearchReference
or if you really want to see all records in the form and only go to the desired record:
Docmd.OpenForm "YourForm"
Forms!YourForm.Recordset.FindFirst "[Order Id] = " & YourSearchReference
Servus
Karl
Access News
Access DevCon
Aug 24, 2022
Hi,
In theory you should be able to set the focus to the ID field and set the OnlyCurrentField parameter of the FindRecord method to True. As that would be too unreliable for me, I wouldn't use that but sth like:
Docmd.OpenForm "YourForm", , , "[Order Id]=" & YourSearchReference
or if you really want to see all records in the form and only go to the desired record:
Docmd.OpenForm "YourForm"
Forms!YourForm.Recordset.FindFirst "[Order Id] = " & YourSearchReference
Servus
Karl
Access News
Access DevCon
KakovostMDM
Aug 26, 2022Copper Contributor
Karl_Donaubauer Thanks a lot, it works perfectly!