Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Changing tag property

how can i change the tag property at a click of a button? im password protecting the form thru the tag property..now ive setup another form to change the passwrod(tag)..my code in that other form is:

On Error GoTo Err_Command9_Click
   
        Dim stDocName As String
        Dim stLinkCriteria As String

        stDocName = "frmAdmin"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
       
        [Forms]![frmadmin].Tag = txtNewPass

after i click the button, i dont get any error msg and the tag property doesnt change either..whats going wrong?
0
thinker388
Asked:
thinker388
  • 4
  • 3
  • 3
  • +4
5 Solutions
 
rockiroadsCommented:
did u try changing the tag property before u open the form?
0
 
knollbertCommented:
Try

        Dim stDocName As String
        Dim stLinkCriteria As String

        stDocName = "frmAdmin"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
       
        [Forms]![frmadmin].form.Tag = txtNewPass
0
 
rockiroadsCommented:
na, u cant unless u first open it in design mode

the alternative is to create a public procedure in that form, then call that passing in the password, and called code does the rest or have a hidden textbox
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
thinker388Author Commented:
i did this:

If txtNewPass = txtCNewPass Then
[Forms]![frmadmin].Tag = txtNewPass
    On Error GoTo Err_Command9_Click
   
        Dim stDocName As String
        Dim stLinkCriteria As String

        stDocName = "frmAdmin"
        DoCmd.OpenForm stDocName, , , stLinkCriteria

still doesnt work
0
 
knollbertCommented:
It worked for me
0
 
knollbertCommented:
Note
[Forms]![frmadmin].form.Tag = txtNewPass
 NOT
[Forms]![frmadmin].Tag = txtNewPass
0
 
walterecookCommented:
Put a break on [Forms]![frmadmin].Tag = txtNewPass
Are you sure txtNewpass has a value at that time?

Walt
0
 
Jag5x5Commented:
Dont think you can at run time permenatly change the tag property of a form that is what you are trying to do yes?

I would create a hidden table and store the password in that.  I usually use a table called tblpref and store the password in that.  I use 2 field key and string I set the key to password and the string to the password.  then I do a dlookup to test if the password is correct and use an rs or a query to change it.

HTH

Jag5x5
0
 
thinker388Author Commented:
knollbert...that didnt work...

rockiroads...can u expand a bit upon the alternative?


create a public procedure in which form? the one with the txtnewpass or the one whose tag property i wanna change..

and where should i call it? and should it have the exact code as in my existing clicck procedure?

and how can i use the hidden textbox?

Thanks...
0
 
thinker388Author Commented:
knoll...ive tried both ways..no luck

walter..im sure...cuz i have two fields..passwd and conf passwd..n i only let the procedure run if they r equal...ive tried typing in diff values for the two passwd boxes..and it didnt run as planned...


jag..yes thats what im trying to do
0
 
rockiroadsCommented:
your original code should work

        DoCmd.OpenForm stDocName, , , stLinkCriteria
        [Forms]![frmadmin].Tag = txtNewPass

and so should's knolbert

do as he suggests

        msgbox "Setting tag to " & txtNewPass
        [Forms]![frmadmin].Tag = txtNewPass

to see what your setting

my idea was something like this

Public Sub SetTag(ByVal sVal As String)
    Me.Tag = sVal
End Sub

then call it like this

        [Forms]![frmadmin].SetTag txtNewPass


but a better idea might be to use the arguments

the last paramater for DoCmd.OpenForm is arguments, if u passed in txtNewPass

then on Form_Load, use OpenArgs

private sub Form_Load()
    Me.Tag = OpenArgs
end sub




0
 
jadedataMS Access Systems CreatorCommented:
The form MUST be opened in acDesignView in order to make the change "stick" to the property.  
Opening in any form view, hidden or not will only change the property while it is open on that occurance.  The property reverts to its default on losing the form.

I would suggest that you use a settings table to drive this process instead of a form property anyway.  You risk locking yourself out of design views if the key property gets set incorrectly.
0
 
GRayLCommented:
I just checked and you can permanently change the tag value of a form at runtime. However to keep the new value of the tag issue:
docmd.close "formName", acSaveYes
0
 
thinker388Author Commented:
ok i just talked with the person  for whom I'm doing this project for, and he said that he's just going to change the tag by going to design view himself. :)

Thanks a lot for the replies...I'll split up the points.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 4
  • 3
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now