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

Columns Changing Widths 1

Status
Not open for further replies.

jennuhw

MIS
Apr 18, 2001
426
US
I saw something once to keep columns from changing widths, but know I can't find it! My columns change widths if they have information in them to when they don't. I have played with width= but they still don't stay the same. Here is my code:

for x = datadate to today step 7

subtable = false
lastdate = "none"
mysql = "SELECT [date] as PunchDate, [In] as InPunch,[Out] as OutPunch FROM Punches WHERE employee_number = '"&Session("EmpNum")
mysql = mysql &"' and [date] BETWEEN #" & x & "# AND #" & x+6 & "# ORDER BY [date]"
set lors = myconnection.execute (mysql)
%>
<table border=&quot;1&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse&quot; bordercolor=&quot;#111111&quot; >
<%
'Writing Dates to Table with a Loop

for z = 0 to 6
response.write &quot;<th colspan=1 colgroup width=&quot;&quot;125&quot;&quot;><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>&quot; & dateadd(&quot;d&quot;,z,x) & &quot;</th></td>&quot;
next

'Writing days of week to table

response.write &quot;<tr><th colspan=1 colgroup width=&quot;&quot;125&quot;&quot;><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Sun</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Mon</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Tues</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Wed</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Thurs</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Fri</th><th colspan=1><p align=&quot;&quot;center&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>Sat</th></tr>&quot;

'Writing Punches to Table
do while not lors.eof

InPunch = lors.fields(&quot;InPunch&quot;).value
OutPunch = lors.fields(&quot;OutPunch&quot;).value
PunchDate = lors.fields(&quot;Punchdate&quot;).value

if lastdate <> punchdate then
if lastdate = &quot;none&quot; then
if weekday(punchdate -1) <> 7 then
for y = 1 to weekday(punchdate -1)
response.write &quot;<td>&nbsp;</td>&quot;
next
end if
else
response.write &quot;</table>&quot;
if weekday((punchdate - lastdate) - 1) <> 7 then
for y = 1 to (weekday(punchdate - lastdate) - 1)
response.write &quot;<td>&nbsp;</td>&quot;
next
end if
end if

response.write &quot;<td valign=top ><table border=&quot;&quot;0&quot;&quot; cellpadding=&quot;&quot;2&quot;&quot; cellspacing=&quot;&quot;0&quot;&quot; bordercolor=&quot;&quot;#111111&quot;&quot; valign=top >&quot;
subtable = true
else
if subtable <> true then
response.write &quot;<td valign=top ><table border=&quot;&quot;0&quot;&quot; cellpadding=&quot;&quot;2&quot;&quot; cellspacing=&quot;&quot;0&quot;&quot; bordercolor=&quot;&quot;#111111&quot;&quot; valign=top >&quot;
end if
end if

response.write &quot;<td nowrap=&quot;&quot;nowrap&quot;&quot; colspan=1 align=top colgroup width=&quot;&quot;62&quot;&quot;><valign =&quot;&quot;top&quot;&quot;><p align=&quot;&quot;left&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>&quot; & InPunch & &quot; &quot; & &quot;<td nowrap=&quot;&quot;nowrap&quot;&quot; colspan=1 align=top colgroup width=&quot;&quot;62&quot;&quot;><valign =&quot;&quot;top&quot;&quot;><p align=&quot;&quot;right&quot;&quot;><font face=&quot;&quot;Tahoma&quot;&quot; size=&quot;&quot;1&quot;&quot;>&quot; &&quot; &quot;& OutPunch & &quot;</td><tr>&quot;

lastdate = punchdate

lors.movenext

loop

response.write &quot;</table></td>&quot;
if subtable = true then
for y = 1 to (7 - weekday(lastdate))
response.write &quot;<td>&nbsp;</td>&quot;
next
end if
next

Any suggestions would be awesome! Thanks.
 
A down and dirty way of keeping table cells the same width is to create a transparent gif that is 1 pixel high and the width of the cell, and place it in the cell. Do this for the first, or last, table row and your table cells will always remain the same width.

There's always a better way. The fun is trying to find it!
 
You could also populate the empty cells with a blank ( ) then the width property will work.

[wavey]
 
Lansauser, what do you mean by a blank? Non-breaking space?
 
I just realized that my &nbsp; didn't show up above. They are in my actual code, but not in the code I posted.
 
TVIMAN, I did the transparent gif file. Took some manuevering to get it the right size, but it worked. Thanks!

[ponytails]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top