Solved

Tag Property in Access

Posted on 2015-02-20
9
194 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 48

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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 48

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

726 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