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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching table and opening form

Status
Not open for further replies.

supervi

MIS
Mar 22, 2003
61
CA

I have a button with the following code



If Len(Me.Text25 & "") <> 0 Then
Me.list1.RowSource = "SELECT * FROM [Annual Load Follow] WHERE [Annual Load Follow]![Counterparty] = '" & Me.Text25 & "'"
Me.list1.Requery

End If

If Len(Me.Contract_Number_ID & "") <> 0 Then
Me.list1.RowSource = "SELECT * FROM [Annual Load Follow] WHERE [Annual Load Follow]![Contract Number ID] = '" & Me.Contract_Number_ID & "'"
Me.list1.Requery

End If


What this does is search the Annual Load Follow table and have it display every record that applies into a list box. Then in the list box we have the following code under double click

DoCmd.OpenForm "Annual Load Follow", , , "[Annual Load Follow]![Deal Ticket Number] = " & Me.list1

This opens the corresponding form that the user searched for.

Here are my problems,

Our table has 2 primary keys, a DEALTICKET NUMBER and a VERSION NUMBER each DEALTICKET NUMBER has multiple Version NUMBERS. When i click the search button it displays several of the same deal ticket number however, when you go to the list box no matter which of the deal ticket numbers you click it always shows the earliest Version Number. How would i fix this to show the latest?


Or else, in my list box, can i get my list box to show both primary keys? The DEAL TICKET NUMBER and the VERSION NUMBER???

Thanks in advance for any input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top