Solved

Tag Property in Access

Posted on 2015-02-20
9
120 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
  • 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:weinberk
weinberk 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:weinberk
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
 
LVL 15

Expert Comment

by:weinberk
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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:weinberk
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now