listVIEW issue

AccessFreak

Registered User.
Local time
Today, 21:38
Joined
Feb 19, 2009
Messages
69
mrvj3k.jpg


The above list is a listview not a listbox. My question is how to get the selected userID value to the textbox left of the button. This must happen after I click on the lookup Employee button
 
is there such a thing as 'listview'? do you mean 'datasheet' view?

i suggest you make your list a combo box. get the user to select which employee they want to view from the combo box (which can be a find record in form control too), and then send the ID to the report (i presume) that you're opening with the button via the WHERE argument in the DoCmd.OpenReport VBA.
 
you dont need to click anything

just use this sort of syntax (possibly - i presume there is some way of dereferencing the control, but im not exactly sure what you have)

=listcontrol.column(3), as the control source of the textbox
 
If what you have is a Data Sheet view as wiklendt suggests, then the following code in the Form's On Click event will be fired when the user clicks the record selector (which is not present in your screen shot?). The code will open a new form with the data linked by your UserID.

Code:
 Dim stDocName As String
 Dim stLinkCriteria As String

 stDocName = "FRM_YourFormName" [COLOR="Green"]'The name of the form to be opened[/COLOR]
    
 stLinkCriteria = "[CommmonLinkID]=" & "'" & Me![CommmonLinkID] & "'"  [COLOR="Green"]'Replace the item between the square brackets with the name of the filed that is common to the two form on which you can link[/COLOR]
 DoCmd.OpenForm stDocName, , , stLinkCriteria
 
A listview is an AxtiveX control in Access. It has a sort-function in the columnheads and does not have a recordselector. It is just as a listbox but with better features I guess. I think its a VB control, not a VBA. I have it in my accessform right now. It searchs the employees but the only thing what must happen is after clicking the button, the selected USERID must get in the textbox.
 
well the activex control must expose to you a number of properties or methods - one of these must enable you to dereference the data - you will have to examine the interface to determine how to do this.
 
Assuming the name of your list view is ListView1 and name of textBox is TextBox1

Code will be as follows

To get the data in first column

TextBox1 = ListView1.SelectedItem



To get the data in Second column

TextBox1 = ListView1.SelectedItem.ListSubItems(1)



In your as visible in picture its column six which contains the userid code will be

TextBox1 = ListView1.SelectedItem.ListSubItems(5)


You have to use above code any where you want to for example
on click event of listview
on DoubleClick event of listview
on click event of button
etc
 
Thanx man.. your great. I knew it was simple..

But know is my new question i got a continues form with the same data as the picture above. I made for every field a textbox and placed it in the header of the form. The functionality of this textbox need to be a lookup for the username, firstname etc.. After I hit a key, the form needs to jump to a record which begins with that character.

How can I do that?
 
Sample is attached

The listview works already, but ofcourse thanx for aaaaall the help. I changed the listview in a subform with a continues form within it. I configured it like the listview I had.

There has to be 2 extra functionality's

  • A filter option. Every column gets his own textbox for filtering data.
  • The textboxes need to have an extra functionality to lookup data from the column while you are typing in the textbox.
 
you can change the sql statement used for filling the list view to incorporate this
 

Users who are viewing this thread

Back
Top Bottom