I have a tag called ITEM_ID which stores the unique names for pieces of furniture stored in a table. All of the names have a prefix separated by a hyphen ("-"). What I need to do is extract the text prior to the hyphen (the prefix) and display it as a piece of text in a report. I have most of the report designed except for a couple of components of which this is one. Thanks in advance.
First of all and as Teddy pointed out, you should not use the hyphen ("-") as a separator as this is an arithmetic operator: whats the meaning of an expression such as "4-2" ? Use the semi-colon as separator list (";") instead.
Now if you store several pieces of data in the Tag property of a control, one easy way to access them separately is:
Dim varIndex As Variant
varIndex = Split(ctl.Tag, ";")
Then the first element stored in the Tag property can be accessed as:
I currently have a table with a field called ITEM_ID and the values stored in this field are extracted from an AutoCAD drawing and dumped in the table. The values all have a prefix of 1 to 2 characters separated by a hyphen. The prefix is used to identify whether the item is a table (T), a bookcase (B), a chair (C) and so on. At the top of each printed report I need to identify what category the item is from, which happens to correspond to the letter prefix. I hope this description is helpful. Thanks.