Solved

Changing tag property

Posted on 2004-07-30
14
293 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
  • 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 100 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
Industry Leaders: 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!

 

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 100 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 100 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 100 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 100 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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

749 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