|
-
Jun 4th, 2000, 05:19 PM
#1
Thread Starter
New Member
I am using VB with a access97 back-end. I have created my database and all the tables I require. Within Vb I have created a recordset and selected the table I want, I have written a for..loop to go through each field in the recordset. But I do not want the field name, I want to access the fields caption property and get the string value of the caption.
The reason for this is because the tables I have created in the database contain digitised data for specific charts. So the field names relate to the section of the graph that was digitised, so the name of the field is related to a particular section of the chart. This is fine when you name the fields whole numbers like 1000,2000,3000..etc. But the problem arises when the name of the field should be 1.00,1.02,.1.04..etc. This creates a invalid field name, so I set the caption of the field to 1.00,1.02,1.04..etc.
But when I create a recordset in VB using ADO, I cannot access the caption property. Can anyone please help????????
-
Jun 4th, 2000, 05:45 PM
#2
morjaria,
unfortunatly there is no easy solution for your problem, at least i didn't find one so far. you have two options:
1) use field names that can be maped to nice captions like ClientName -> Client Name ....
2) access all your data via queries and use the 'As' statement to change field names ('Select Id As [Account No] From tblClient')
hope that helps
Sascha
-
Jun 5th, 2000, 09:35 PM
#3
Thread Starter
New Member
Originally posted by morjaria
None of the two options will work.
Because the function I created is generic, it will take any chart name and there is a table associated with this chart, containing the digitised data. I can't assign aliases because I am selecting all the fields in the table and because it is generic the field names I select will be different, each time I call the function.
I did find a different way of doing the job. I named the fields that should be named with a decimal place within them, all I did was to changed the full stop to a comma and then created a function that if a field name contains a comma then assign this name to a string and replace the comma with a fullstop and use this value.
But I would still like to know how to access a field caption property in a table from code, in ADO.
-
Jun 5th, 2000, 11:49 PM
#4
PowerPoster
MSCHRT20.OCX?
Hi Morjaria are you using the MSChart Control 6.0 for your chart plotting module?
If yes, you may be can do it like this...
Assume you have:
- Field1 is the database fields that store your Column Lable.
- Field2 is the database fields that store your Row Label.
- FieldData is the database fields that store all your chart value/data.
Code:
With MSChart1
.chartType = 1
While Not Rs.EOF
Bla...Bla...Bla... with all your logic here
.Data = Rs.FieldData
.ColumnLabel = Rs.Fields1
.RowLabel = Rs.Fields2
Rs.MoveNext
Wend
End With
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|