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

dynamic field in table

Status
Not open for further replies.
Mar 31, 2003
22
EU
Hi,

I have a table called ´tblTest´ with 3 fields,
TestID, TestName, TestValue.

The problem is with the field ´TestValue´, I want the type to be able to change for each new record

Example...
TestID TestName TestValue
------- -------- ----------
1 TestA 3.14(single)
2 TestB valueB(value could be text, int, single or OLE).

I presume I would need a second table with a field called ´Type´ listing all the types and some sort of link to tblTest.

Your help is appreciated….
 
Hi,
I don't think you need another table, just another field that can have list values associated with them. Here are the steps to make it work:
1) Add the new field (perhaps "testValueType") and make it Text type.
2) Click on Lookup, then change Display Control to ListBox.
3) Click on Row Source Type, and select Value List.
4) Copy this into Row Source:
"Text";"Single";"Double";"OLE";"Int"
5) Modify the list with your types of data.
6) Your code can then convert the text datatype into the appropriate datatype with functions, such as CDbl, CInt, CStr, etc. To see more of these functions, go into Visual Basic help, and enter "Type Conversion". HTH, [pc2]
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top