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 / Queries / May 2008

Tip: Looking for answers? Try searching our database.

Find a number and return corresponding fields in that record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JBad - 19 May 2008 09:24 GMT
Hi..
i want to find a number (employee code) and if that exists in the table
(employee master), then retrieve the rest of the details of that record and
display those deails in either textboxes or labels (which would b not
editable).

wht is the easiest way to do it? i've tried the findrec & bookmark methods
but i cant make it work..
following is the code i use for bookmark method:

Dim rs As Recordset

   Set rs = Me.RecordsetClone
   
   rs.FindFirst “EmpNo = “ & txtBox_1.Value    'txtBox_1.value is wht the
user enters
       
   If Not rs.NoMatch = True Then
       Me.Bookmark = rs.Bookmark
       
   End If
Evi - 19 May 2008 10:01 GMT
Create a form based on Employee Master and containing those fields which you
want to see. In Design View, click on Properties and on the Data tab you can
set Allow Editions, Allow Deletes etc to No.

When you add your button, choose the option to open this form and to display
certain records, choose any field for your match. It won't give you the
option of your text box but that doesn't matter.

Edit the code so that instead of saying eg
stLinkCriteria = "[CmID]=" & Me![CmID]

it now says your true criteria

stLinkCriteria = "[EmpCode]=" & Me.txtBox_1

(if EmpCode is a number field)

or

stLinkCriteria = "[EmpCode]=" & "'" &  Me.txtBox_1 & "'"

(if it is text)

The bit after the ampersand and at the end is

Quote Apostrophe Quote

Evi

> Hi..
> i want to find a number (employee code) and if that exists in the table
[quoted text clipped - 17 lines]
>
>     End If
 
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.