Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have a form (Employee) on

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Hi,

I have a form (Employee) on this form I have a preview serp button. I want to preview the employee's current record. For example, John Stuart has three records I want to preview his most recent record.

This is the code I have for the preview serp button:


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "SIP/SESP Distribution"

stLinkCriteria = "[Employee Information]=" & "'" & Me![Employee Information] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
I really need someone to help me with this one... Thanks
 
Hi!

What you can do is base the Employee form on a query:

Select Top 1 "All of your fields" From YourTable(s) Where [Employee Information] = Forms!YourFormName![Employee Information] Order By YourDateField Desc

Now, you can just open the form and it will have the information you are looking for. Setting this up in the QBE should be pretty simple. One note, it is usually best to give your text/combo/list boxes names that are different from the fields in your tables.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Hi Jerby,

I created a query of the table and I don't know where I should put the expression you provided...In which field??? and should it be in criteria?

Please Explain:
Select Top 1 "All of your fields" From YourTable(s) Where [Employee
Information] = Forms!YourFormName![Employee Information] Order
By YourDateField Desc

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top