Solved

Tag Property in Access

Posted on 2015-02-20
9
160 Views
Last Modified: 2015-02-20
How do you allow 2 tags in the tag property . One tag is "Required" and I also need "Audit" tried semicolon and comma but that negates both
0
Comment
Question by:Spikemom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 40621398
you could do both, but then the code that checks for that value will have to use something like the instr() function to test for those values:

if instr(me.txt_SomeControl.Tag, "Required") > 0 then
   'do something
ELSEIF instr(me.txt_SomeControl.tag, "Audit") > 0 then
   do something else
endif
0
 
LVL 15

Assisted Solution

by:Berkson Wein
Berkson Wein earned 250 total points
ID: 40621400
The tag property is singular unfortunately.  It's just a single string.  I don't know how you're using the tag, but you might use a tag like
RequiredAudit
to indicat to your functions that this essentially has two properties.  You'd need to test for it something like this rough concept code:

If Field.tag = "Required" or Left(Field.Tag,length("Required")="Required") then
    do whateer
end if
If Field.tag = "Audit" or RIGHT(Field.Tag,5)="Audit") then
    do whateer
end if

Hope this helps.
0
 
LVL 15

Expert Comment

by:Berkson Wein
ID: 40621409
Dale and I posted the same basic code (at the same time), though I do prefer Dale's instr method over my rough code.  That way it doesn't matter if you have
RequiredAuth, Required;Auth, AuthRequired, Auth and Required
it'll catch it all.

Just remember that you're testing against a SINGLE string.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 15

Expert Comment

by:Berkson Wein
ID: 40621472
I'm sorry that you consider this only a "B" graded answer.  

Is there something that was unclear and that you need more help with?  I thought my explanation and algorithm along with Dale's excellent code should have been everything you needed.  Not only did you get an explanation of why the concept you were trying wasn't going to work (because you need to process the singular string field), but you were given the code to do it right.

In the future, please remember that the only thanks we get is your grade.  If there is something that's still unclear, feel free to continue asking until you're satisfied.  And if you can't get a complete answer, then feel free to grade less than an A.

-from an apparently overly-sensitive today expert on behalf of the rest of us.
0
 

Author Comment

by:Spikemom
ID: 40621483
Sorry I should have given you an A and will next time. Please forgive this time.  

Spikemom
0
 
LVL 15

Expert Comment

by:Berkson Wein
ID: 40621485
forgiven.  absolutely.
0
 
LVL 75
ID: 40621945
Keep in mind it's not that hard to accidentally blow out the content of the Tag property on the Control property sheet. If this happens, then you've got nothing. I've seen it happen. Same with hard coded Default Values at the Table or Form level.
Consider using a simple local table to store there sorts of 'tags' for a required field (et al), which can be read with a simple DLookup()  ... or initialize TempVars with these values on Form Load. TempVars remain in effect even if a 'reset' occurs which would clear regular variables.

mx
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40621962
"blow out the content of the tag property"  ???

I use the Tag property all the time for things like "required", don't recall ever losing those values.
0
 
LVL 75
ID: 40622002
I would never use it. I'm a 'table driven' guy :-)
Much easier to maintain, update, discover, etc.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question