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!

Setting Tag Property 1

Status
Not open for further replies.

dmarsh16946

Technical User
Feb 28, 2009
20
GB
Have a form where individual fields can be locked by setting their tag values to "?", or unlocked by setting to "" (thanks for the procedure AceMan, it's been so useful).

Users may want to change which fields they want to lock so I'd like to make it easy to tag or untag fields without having to go into each field's Properties separately.

Did think of having an unbound checkbox beside each field with an AfterUpdate

If Me.Check10 = -1 Then
Me.FirstName.Tag = "?"
Else
Me.FirstName.Tag = ""
End If


But these of course clear themselves when the form is reopened.

So any ideas appreciated how to make the tag settings stick.
 
Only changes made when the form is in design view, persists, I think.

If you want to allow such user customization, I think I'd place the information in a table containing the name of the controls for which you want this customization and a yes/no field.

Then for instance in the on load of the form, you could open and loop a recordset based on this table and perform the locking (or whatever appropriate event).

Roy-Vidar
 
How are ya dmarsh16946 . . .

As an alternative you could use a [blue]custom db property[/blue] to hold the field names that were tagged with the question mark. [blue]Custom db properties[/blue] (like tables) are [green]non-volatile[/green] and stay with the db (frontend) even if the db is closed! [thumbsup2] So on opening the form you'd always have the latest. The only difference in reference to that provided by [blue]RoyVidar[/blue] is saving overhead of the table and table access code. Also, [blue]custom db properties[/blue] are hidden and can only be viewed thru code.

The Idea is to loop thru the controls building a [blue]semicolon delimited string[/blue] of the tagged control names and storing the result in the [blue]custom db property[/blue]. This would occur in the forms [blue]On Unload[/blue] event.

Now when you open the form the [blue]On Load[/blue] event calls the [blue]custom db property[/blue] and splits it into an array that is looped, [blue]restoring the tags![/blue].

Although I have run a simulation that works just fine, Wether you use a [blue]table[/blue] or a [blue]custom db property[/blue] is up to you. There should no performance issues which ever method you choose.

[blue]Your Thoughts? . . .[/blue]

BTW: Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2] [blue]Its Worthy Reading![/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Chaps

Very grateful for quick response but finding myself short on knowledge to try what you suggest. Are there any examples you can point to, or maybe a bit more of a leg up?
 
dmarsh16946 . . .

See my post in thread702-1236022 for setup and code for using db properties.

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top