Listview Control (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 04:27
Joined
Oct 30, 2008
Messages
1,257
I was hoping to change my database from a subForm to a Listview control. However I've just found out Listview doesn't support editing of the sub items. I'll need to change to use a normal grid control, or place a textbox on top of the listview.


Has anyone done this, how practical is it ?
What a normal grid control is and would it be a substitute for a Listview?
Thanks for any info.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:27
Joined
Feb 19, 2013
Messages
16,605
your lanquage is that of VB/.net etc, not of access. I suspect what you mean by a 'normal grid control' is a datasheet view of a form - which you then set as the sourceobject on a subform control.
 

kirkm

Registered User.
Local time
Tomorrow, 04:27
Joined
Oct 30, 2008
Messages
1,257
It's (at least so far) working in Access. I was intending to try this instead of a sub form to let me detect a click on the column header. Which I don't think an Access Datasheet Form does ?
But if it isn't editable, it's probably not worth it.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:27
Joined
Feb 19, 2013
Messages
16,605
datasheets are editable if the underlying recordsource is editable.

There is a click event (and others) on the column rather than the header. If you want just on the header then you need to use a continuous form which can be made to look like a datasheet and with the right coding have some of the datasheet properties such as adjusting column widths, changing their position etc.
 

kirkm

Registered User.
Local time
Tomorrow, 04:27
Joined
Oct 30, 2008
Messages
1,257
I had asked about a click on just the header and had no replies, so assumed it wasn't possible.
However just tried form "On Click" and it works! I don't know if it continuous or not, but its displayed as datasheet, so I can probably do all I wanted.
 

Micron

AWF VIP
Local time
Today, 12:27
Joined
Oct 20, 2018
Messages
3,478
I had asked about a click on just the header and had no replies
Didn't see it. Not exactly sure what you want from that though. Caption of the label that becomes the header of the column? If so and clicking on the column header, maybe MouseUp. If in a record, form Current perhaps:

MsgBox Me.ActiveControl.Controls(0).Caption

provided that the labels are attached to/associated with the controls that apply to the fields.
 

kirkm

Registered User.
Local time
Tomorrow, 04:27
Joined
Oct 30, 2008
Messages
1,257
I can't find the msg now, but the code given was
Code:
    If sActiveControlName = "" Then subCDTracks_Exit True
    MsgBox  sActiveControlName
End Sub
Private Sub subCDTracks_Exit(Cancel As Integer)
    sActiveControlName = Me!subCDTracks.Form.ActiveControl.Name
End Sub
If I try Msgbox Me!subCDTracks.Form.ActiveControl.Controls(0).Caption
it sometimes works, but other times it shows the first control on the subform, whcih is what I was getting before changing to the code above.
 

Micron

AWF VIP
Local time
Today, 12:27
Joined
Oct 20, 2018
Messages
3,478
Without testing a db copy or maybe seeing the rest of your attempt I have not much of an idea. Don't forget though, that to make use of a control's controls collection, the label has to be "attached", and the only possible member of the control's controls collection is a label. Other than that, can't say why it would be sporadic aside from possibly the active control isn't the one you think it is. The way I name controls, the name of the control wouldn't be that useful to a user methinks, so Caption is the way I handled these cases. However, I try not to use Active anything because it's not 100% reliable IMHO.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:27
Joined
May 21, 2018
Messages
8,527
However I've just found out Listview doesn't support editing of the sub items. I'll need to change to use a normal grid control, or place a textbox on top of the listview
I would strongly stay away from using a listview (MSCOMCTL.OCX) or flexgrid (MSFLXGRD.OCX). Neither are supported anymore and no 64 bit version exists. Even if you can get them to work unlikely will work on another user machine.
Yes Access desperately needs an unbound grid control, but you can fake this if needed.
 

Users who are viewing this thread

Top Bottom