[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Changing tag property

Posted on 2004-07-30
14
Medium Priority
?
298 Views
Last Modified: 2008-02-20
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
Comment
Question by:thinker388
[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
  • 3
  • 3
  • +4
14 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 11678530
did u try changing the tag property before u open the form?
0
 
LVL 6

Assisted Solution

by:knollbert
knollbert earned 400 total points
ID: 11678562
Try

        Dim stDocName As String
        Dim stLinkCriteria As String

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

Expert Comment

by:rockiroads
ID: 11678568
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:thinker388
ID: 11678570
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
 
LVL 6

Expert Comment

by:knollbert
ID: 11678571
It worked for me
0
 
LVL 6

Expert Comment

by:knollbert
ID: 11678575
Note
[Forms]![frmadmin].form.Tag = txtNewPass
 NOT
[Forms]![frmadmin].Tag = txtNewPass
0
 
LVL 17

Assisted Solution

by:walterecook
walterecook earned 400 total points
ID: 11678577
Put a break on [Forms]![frmadmin].Tag = txtNewPass
Are you sure txtNewpass has a value at that time?

Walt
0
 
LVL 5

Expert Comment

by:Jag5x5
ID: 11678585
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
 

Author Comment

by:thinker388
ID: 11678603
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
 

Author Comment

by:thinker388
ID: 11678644
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
 
LVL 65

Accepted Solution

by:
rockiroads earned 400 total points
ID: 11678679
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
 
LVL 32

Assisted Solution

by:jadedata
jadedata earned 400 total points
ID: 11684672
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
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 400 total points
ID: 11685175
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
 

Author Comment

by:thinker388
ID: 11704507
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

Independent Software Vendors: 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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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 …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

650 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