Hello All,
I have a program that populates a listview control with four columns of data. The data comes from an access database and are Names, DOB, Address, and Room#. What I am trying to do is allow the user(my wife) to print a list of all of the children in the listview control. What I have done so far is.
for x=1 to listview1.listitem.count
cname=listview1.listitems(x)
dob=listview1.listitems(x).listsubitems(1)address=listview1.listitems(x).listsubitems(2)
room=listview1.listitems(x).listsubitems(3)
printer.print cname & vbtab & dob & vbtab & address & vbtab & room
next x
the problem I am having is that I want all of the columns to be lined up, but they are all "S" shaped.
Juan 04/13/2000 Wherever Street Green Room
Billy S 03/18/1999 Wherever Street Yellow Room
Sam 01/24/1999 Wherever Street Red Room
I know this is because the columns are filled with text of different lenghts. I have tried an If..Then.. statement dependent upon the len(cname)'length of string, but because some of the names contain a lot of iii's the string takes up fewer spaces than a shorter string made up of wider characters.
Any help is appreciated.
P.S. While not on the subject of databases. What is the diffence between using SQL queries and the VB methods to select from different catagories. I have seen some of the queries Select * From . . . something or other and I am still a bit confused. I just use the following type statements:
dim rs as recordset
dim db as database
set db=opendatabase("somedatabase"
set rs=db.openrecordset("Sometable"
do while not rs.eof
if rs.fields(0).value="What I am looking for" then "Do what I want"
rs.movenext
x=x+1
loop
works for me. Is SQL faster or is it just preference?
Thank you,
T. Smith
I have a program that populates a listview control with four columns of data. The data comes from an access database and are Names, DOB, Address, and Room#. What I am trying to do is allow the user(my wife) to print a list of all of the children in the listview control. What I have done so far is.
for x=1 to listview1.listitem.count
cname=listview1.listitems(x)
dob=listview1.listitems(x).listsubitems(1)address=listview1.listitems(x).listsubitems(2)
room=listview1.listitems(x).listsubitems(3)
printer.print cname & vbtab & dob & vbtab & address & vbtab & room
next x
the problem I am having is that I want all of the columns to be lined up, but they are all "S" shaped.
Juan 04/13/2000 Wherever Street Green Room
Billy S 03/18/1999 Wherever Street Yellow Room
Sam 01/24/1999 Wherever Street Red Room
I know this is because the columns are filled with text of different lenghts. I have tried an If..Then.. statement dependent upon the len(cname)'length of string, but because some of the names contain a lot of iii's the string takes up fewer spaces than a shorter string made up of wider characters.
Any help is appreciated.
P.S. While not on the subject of databases. What is the diffence between using SQL queries and the VB methods to select from different catagories. I have seen some of the queries Select * From . . . something or other and I am still a bit confused. I just use the following type statements:
dim rs as recordset
dim db as database
set db=opendatabase("somedatabase"
set rs=db.openrecordset("Sometable"
do while not rs.eof
if rs.fields(0).value="What I am looking for" then "Do what I want"
rs.movenext
x=x+1
loop
works for me. Is SQL faster or is it just preference?
Thank you,
T. Smith