Re: string is interperted literally
- From: Salad <oil@xxxxxxxxxxx>
- Date: Fri, 04 Jan 2008 08:56:31 -0800
pmacdiddie@xxxxxxxxx wrote:
On Jan 4, 12:07 am, CDMAPos...@xxxxxxxxxxxxxxxx wrote:
On Jan 3, 11:29 pm, pmacdid...@xxxxxxxxx wrote:
Sorry, I know this has been done 1000 times. The problem is i need to
loop though a recordset and I dont know the field names, so they have
to be looked up. When i pass them to get the values, it passes as a
literal.
fcount = rs.Fields.Count
'Debug.Print fcount
For i = 0 To fcount - 1
StrText = StrText & "rs![" & rs.Fields(i).Name & "] & "
Debug.Print StrText
ctGrid0.AddColumn rs.Fields(i).Name, rs.Fields(i).Size
ctGrid0.ColumnSortable(i) = -1
If fcount - i = 1 Then
Do While Not rs.EOF
ncount = ctGrid0.AddItem(StrText) ****** Problem is here,
StrText is interperted as string
rs.MoveNext
Loop
rs.Close
End If
Thanks in advance for the help.
Maybe:
varFieldValue = rs(rs.Fields(i).Name)
Note: varFieldValue can be Null.
James A. Fortune
CDMAPos...@xxxxxxxxxxxxxxxxx Hide quoted text -
- Show quoted text -
unfortunately that does not work either. I am able to get the value
initially, so I can get the value inside the for loop, but in the do
while loop, the variables are treated as text, so i get the same thing
all the way through the record set.
Wouldn't your value of strText be something like
"rs![Field1] & rs![Field2] & rs![Field3] & rs![Field4] & "...
when you get to 1?
You put a
Debug.Print StrText
in your code. Whats the output? Something like
rs![Field1] &
rs![Field1] & rs![Field2] &
rs![Field1] & rs![Field2] & rs![Field3] &
rs![Field1] & rs![Field2] & rs![Field3] & rs![Field4] &
?
You mention "StrText is interperted as string". Most of us would think that strText is a string. What do you think it should be?
Flowers
http://www.youtube.com/watch?v=hMGpGZvr-G0
.
- References:
- string is interperted literally
- From: pmacdiddie
- Re: string is interperted literally
- From: CDMAPoster
- Re: string is interperted literally
- From: pmacdiddie
- string is interperted literally
- Prev by Date: Re: Memo fields
- Next by Date: Re: Memo fields
- Previous by thread: Re: string is interperted literally
- Next by thread: Re: string is interperted literally
- Index(es):
Relevant Pages
|