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

list box changed to datasheet form

Status
Not open for further replies.

smiley0q0

Technical User
Feb 27, 2001
356
0
0
US
I used to have a list box that listed several locations and other quick summary items from a table, if the users double clicked on one of the items a form would come up with the detail for that location.
the users thought it would be nice to be able to sort by the columns in the list box, the only way i knew how to do that is to create a subform in datasheet view instead of a list box, that way they can sort it by whatever column they want.
the problem that i have run into is i still want the form to come up if they double click on a record. how do i get it to select to record when they click on any field in that record and if they double click on any field it will open the detail form, using my location as the filter?

Make any sense at all?
if not, ask some more questions, i'll be happy to explain some more..

Thanks,
Smiley
 
smiley

what you have to do is refernce the sub form

here some sample code for you this should be in the detail form

Private Sub Form_Open(Cancel As Integer)
Dim Frm As Form_address_subform
Set Frm = Form_address_subform
DoCmd.ApplyFilter , "Name = '" & Frm.Name1 & "'"
End Sub

in your sub form put the open command on every textbox that way no matter what field the user click on it will
open the details form

Private Sub Address_DblClick(Cancel As Integer)
DoCmd.OpenForm "details"
End Sub


if you require any more help let me know

Shrek
 
Here is my code that i used for my list box.

Private Sub LstLocationList_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FrmLocationDetail"

stLinkCriteria = "[Location]=" & Me![LstLocationList]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

Wouldn't i be able to use something similar with the sub form? instead of using my detail form to filter the data, just start the filter from the sub form? does that make sense?
i just don't know how to link it to the record they clicked on...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top