473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Microsoft ListViewControl, ver 6.0(SP3)

Hi!
The default ListBox control in ms access 2000 can't show the
gridlines. I could "fake" it by setting the listbox Special effect to
'Flat' and Font to underline, but this is not good enough for a user
that needs glasses. Also I need to use a very small font, ms sans
serif size 8, because of trillions of records.

Can anybody show how to retrieve data from a table and fill the
lstViewCtl, which is an ActiveX control, with data.

I know how to do this with the equivalent in Delphi 6, and I have
tried to follow that pattern. However...The Microsoft ActiveX control
seem to have a different approach.

I can't seem to find a way to access the columnHeader or anything but
the 'name' property.

So, anybody..?

Me.Name
Nov 13 '05 #1
4 7325
In Access the control on the form is a container for the activex OBJECT
(capitalised to emphasise the word).

So with a listview you could do the following

PUt a listview control (ListView0) and a command button (Command1) on a
form, add the fllowing code and change the select statement as appropriate.

Private Sub Command1_Click()
Call FillList
End Sub

Private Sub FillList()
Dim lv As MSComctlLib.ListView
Dim loCon As ADODB.Connection
Dim loRst As ADODB.Recordset

' Note: here we're testing assigning from the object property of the control
If TypeOf Me.ListView0.Object Is MSComctlLib.ListView Then
Set lv = Me.ListView0.Object
Set loCon = Access.CurrentProject.Connection
Set loRst = loCon.Execute("Select * from MyTable")

With lv
.ColumnHeaders.Add Text:="a"
.View = lvwReport
End With

With loRst
Do Until .EOF
lv.ListItems.Add Text:=.Fields(0) & ""
.MoveNext
Loop
End With
End If
Set lv = Nothing

End Sub
--
Terry Kreft
MVP Microsoft Access
"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hi!
The default ListBox control in ms access 2000 can't show the
gridlines. I could "fake" it by setting the listbox Special effect to
'Flat' and Font to underline, but this is not good enough for a user
that needs glasses. Also I need to use a very small font, ms sans
serif size 8, because of trillions of records.

Can anybody show how to retrieve data from a table and fill the
lstViewCtl, which is an ActiveX control, with data.

I know how to do this with the equivalent in Delphi 6, and I have
tried to follow that pattern. However...The Microsoft ActiveX control
seem to have a different approach.

I can't seem to find a way to access the columnHeader or anything but
the 'name' property.

So, anybody..?

Me.Name

Nov 13 '05 #2
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:<-D********************@karoo.co.uk>...
In Access the control on the form is a container for the activex OBJECT
(capitalised to emphasise the word).

So with a listview you could do the following

PUt a listview control (ListView0) and a command button (Command1) on a
form, add the fllowing code and change the select statement as appropriate.

Private Sub Command1_Click()
Call FillList
End Sub

Private Sub FillList()
Dim lv As MSComctlLib.ListView
Dim loCon As ADODB.Connection
Dim loRst As ADODB.Recordset
I don't use ADO, only DAO. Any difference?
' Note: here we're testing assigning from the object property of the control
If TypeOf Me.ListView0.Object Is MSComctlLib.ListView Then
Set lv = Me.ListView0.Object
Set loCon = Access.CurrentProject.Connection
Set loRst = loCon.Execute("Select * from MyTable")

With lv
.ColumnHeaders.Add Text:="a"
.View = lvwReport
End With

With loRst
Do Until .EOF
lv.ListItems.Add Text:=.Fields(0) & ""
.MoveNext
Loop
End With
End If
Set lv = Nothing

End Sub
--
Terry Kreft
MVP Microsoft Access
"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hi!
The default ListBox control in ms access 2000 can't show the
gridlines. I could "fake" it by setting the listbox Special effect to
'Flat' and Font to underline, but this is not good enough for a user
that needs glasses. Also I need to use a very small font, ms sans
serif size 8, because of trillions of records.

Can anybody show how to retrieve data from a table and fill the
lstViewCtl, which is an ActiveX control, with data.

I know how to do this with the equivalent in Delphi 6, and I have
tried to follow that pattern. However...The Microsoft ActiveX control
seem to have a different approach.

I can't seem to find a way to access the columnHeader or anything but
the 'name' property.

So, anybody..?

Me.Name


Thanks for responding!
Me.Name
Nov 13 '05 #3
Hi!

I tried your advice but I only get filled the first column.
I also had to change the code a little and even "translated" it to DAO.
It works in both cases, but only the first column is being filled.

Here's the ADODB example:
=========================
Dim lv As MSComCtlLib.ListView
Dim loCon As ADODB.Connection
Dim loRst As ADODB.Recordset
Dim strSql as String //My addition

strSql = _
"SELECT PostItID,Contact,Pho,Fax,Mob,PM,MyDate " _
& "FROM tblPostItID " _
& "WHERE (((MyDate) = DAte())) "_
& "ORDER BY Contact;"

On Error GoTo Err_1
if TypeOf Me!lstPostIt.Object IS MSComCtlLib.ListView then
Set lv = Me!lstPostIt.Object
Set loCon = Access.CurrentProject.Connection
Set loRst = loCon.Execute(strSql)

//Now the following isn't allowed in code, because it returns an error saying
//this property is only 'Readonly'(?)

'On Error GoTo Err_2
'lv.ColumnHeaders = 6
'lv.ColumnHeaders.Add Text :="CONTACT NAME"
'...etc..
'lv.View = lvwReport

On Error GoTo Err_3
with loRst
Do Until .EOF
lv.ListItems.Add Text:= .Fields(1) & ""
...etc...
.MoveNext
Loop
End With
End If

Set lv = Nothing

Alas...Only the first column get filled with data. What is the clue to success here?

My clients runs Win98, Win NT and Win 2000. Should I consider moving from
DAO to ADODB? Is there any benefits in this?

Thanks for guiding me. Any other tip is welcome.

Me.Name
Nov 13 '05 #4
You need to refer to the Subitems collection of the row you just added.

Dim itmX As ListItem

Set itmX = ListView1.ListItems.Add(, , LCase$(sFileName))

itmX.SubItems(1) = vbGetFileSizeKBStr(WFD.nFileSizeHigh +
WFD.nFileSizeLow)
itmX.SubItems(2) = fType
itmX.SubItems(3) = vbGetFileDate$(WFD.ftCreationTime)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hi!

I tried your advice but I only get filled the first column.
I also had to change the code a little and even "translated" it to DAO.
It works in both cases, but only the first column is being filled.

Here's the ADODB example:
=========================
Dim lv As MSComCtlLib.ListView
Dim loCon As ADODB.Connection
Dim loRst As ADODB.Recordset
Dim strSql as String //My addition

strSql = _
"SELECT PostItID,Contact,Pho,Fax,Mob,PM,MyDate " _
& "FROM tblPostItID " _
& "WHERE (((MyDate) = DAte())) "_
& "ORDER BY Contact;"

On Error GoTo Err_1
if TypeOf Me!lstPostIt.Object IS MSComCtlLib.ListView then
Set lv = Me!lstPostIt.Object
Set loCon = Access.CurrentProject.Connection
Set loRst = loCon.Execute(strSql)

//Now the following isn't allowed in code, because it returns an error
saying
//this property is only 'Readonly'(?)

'On Error GoTo Err_2
'lv.ColumnHeaders = 6
'lv.ColumnHeaders.Add Text :="CONTACT NAME"
'...etc..
'lv.View = lvwReport

On Error GoTo Err_3
with loRst
Do Until .EOF
lv.ListItems.Add Text:= .Fields(1) & ""
...etc...
.MoveNext
Loop
End With
End If

Set lv = Nothing

Alas...Only the first column get filled with data. What is the clue to
success here?

My clients runs Win98, Win NT and Win 2000. Should I consider moving from
DAO to ADODB? Is there any benefits in this?

Thanks for guiding me. Any other tip is welcome.

Me.Name

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: George Hester | last post by:
Easily. Go to this page: http://support.microsoft.com/default.aspx?scid=kb;en-us;224979 And then use their second example the clientcap.htm and clientcap.asp section. Then fire up...
10
by: Bob Darlington | last post by:
I have been getting the above error message intermittently when I open any one of five or six forms in design view, change some control formatting (like backcolor) and try to open the form in form...
1
by: Q2004 | last post by:
How do I detect the double click event on item (row) in listviewcontrol ? I didn't see any such event provided in .NET ListViewControl class. Thanks.
4
by: psb | last post by:
not sure if anyone still uses this, but I installed .NetFramework 1.0 sp3 (released, aug31,2004) and after that I was getting some javascript errors. I have a user control inside a webform. ...
7
by: David P. Donahue | last post by:
Greetings, I'm using a relatively old release of Visual Studio .NET and am running into a compatability problem with one of my ASP .NET websites. From what I've gathered from support of the...
0
by: Kirkulontus | last post by:
Hello I currently have a Windows CE (41.0) application that requires SP3 to run. The application is installed in the \FLASH memory folder so its saved after powerloss however the installed SP3...
0
by: David Regan | last post by:
I want to build a web service using .NET Framework 2.0 that implements the WS-* specs that were current when WSE 2.0 SP3 was released. In other words, I want to interoperate with clients that use...
1
by: Cirene | last post by:
I'm thinking about installing XP SP3. Does it work pretty well with VS2008 SP1 and associated products (SQL Server 2005 SP2), etc...? Should I install XP SP3 before or after VS2008, VS2008 SP1,...
3
by: Salad | last post by:
I have Microsoft Office Professional 2003 and the computer I connect to also has A2003 retail. The others in that office use Access 2003 runtime. Q1) I wanted to see if they were up-to-date on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.