dbTalk Databases Forums  

string is interperted literally

comp.databases.ms-access comp.databases.ms-access


Discuss string is interperted literally in the comp.databases.ms-access forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
pmacdiddie@gmail.com
 
Posts: n/a

Default string is interperted literally - 01-03-2008 , 11:29 PM






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.

Reply With Quote
  #2  
Old   
CDMAPoster@fortunejames.com
 
Posts: n/a

Default Re: string is interperted literally - 01-04-2008 , 12:07 AM






On Jan 3, 11:29*pm, pmacdid... (AT) gmail (DOT) com wrote:
Quote:
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
CDMAPoster (AT) FortuneJames (DOT) com


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.