Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / July 2007

Tip: Looking for answers? Try searching our database.

Search in specific field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DrewBe - 30 Jul 2007 23:04 GMT
I would like to refine my abilities to search within the records with a
command button in form view.  I need it to only search in the PRIMARY KEY
field.  not in the field which the cursor is in...
Signature

DrewBe

fredg - 31 Jul 2007 01:02 GMT
> I would like to refine my abilities to search within the records with a
> command button in form view.  I need it to only search in the PRIMARY KEY
> field.  not in the field which the cursor is in...

How does Access KNOW which PK value to go to?

Using an InputBox?

If the PK field is a Number datatype then, for example:

Me.RecordsetClone.FindFirst "[PKFieldName] =" & InputBox("What
value?")
Me.Bookmark = Me.RecordsetClone.Bookmark

If the PK field is a Text datatype, then:

Me.RecordsetClone.FindFirst "[ID] = '" & InputBox("What value?") & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark  
       
You can adapt the above to a Control on a form to input the value to
be searched for...
Me.RecordsetClone.FindFirst "[PKFieldName] = " & Me![ControlName]

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

DrewBe - 31 Jul 2007 01:24 GMT
That works slick as a whistle ... Thank you fredg.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.