Me.Tag=-1 Does this look familiar to anyone?

F

Fred Boer

Hello:

Ok, ok, so I obviously am sadly lacking in the amount of documentation in my
code... Mea Culpa! Mea Culpa! Mea Maxima Culpa!

I've just noticed odd lines in two different subs in my application. (I've
reproduced the subs below.)

I have *no* idea what "Me.Tag=-1" and "Me.Tag=0" are doing in my code. I
understand that they would set the "Tag" property for (I think) the form to
be either True or False. However, I can't find any other code that might
need my forms to have this property set! I have no recollection of how or
why they are there, and, yes, there is not documentation thanks to the lazy
slob who wrote the code. <g>

Does this usage look familiar to anyone? I've commented it out and
everything *seems* ok, but...

Thanks!
Fred Boer



Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

Me.Tag = -1

DoCmd.Maximize


Exit_Form_Open:
Exit Sub

Err_Form_Open:
fncWRMSErrMsg err.Number, err.Description
Resume Exit_Form_Open

End Sub


Private Sub cboPatronFullName_AfterUpdate()
On Error GoTo Errorhandler

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Fullname] = '" & Me![cboPatronFullname] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.cboPatronFullname = Null

Me.Tag = 0

If Me.txtPatronType_ID <> 0 Then
Me.txtStaffFullname.Visible = False
Else
Me.txtStaffFullname.Visible = True
End If

Exitpoint:
Exit Sub
Errorhandler:
fncWRMSErrMsg err.Number, err.Description
Resume Exitpoint


End Sub
 
K

Ken Snell [MVP]

Looks like the code is using the form's Tag property to store a value that
tells you whether the form has been "moved" to a specific record via the
FindFirst search in the RecordsetClone. Probably you were wanting to use
that as a flag at some point for this condition?

The .Tag property is often used as a storage place for many things!
 
F

Fred Boer

Dear Ken:

Who knows? You might be right... We'll probably never know... Thanks for the
help!

Fred

Ken Snell said:
Looks like the code is using the form's Tag property to store a value that
tells you whether the form has been "moved" to a specific record via the
FindFirst search in the RecordsetClone. Probably you were wanting to use
that as a flag at some point for this condition?

The .Tag property is often used as a storage place for many things!

--

Ken Snell
<MS ACCESS MVP>

Fred Boer said:
Hello:

Ok, ok, so I obviously am sadly lacking in the amount of documentation
in
my
code... Mea Culpa! Mea Culpa! Mea Maxima Culpa!

I've just noticed odd lines in two different subs in my application. (I've
reproduced the subs below.)

I have *no* idea what "Me.Tag=-1" and "Me.Tag=0" are doing in my code. I
understand that they would set the "Tag" property for (I think) the form to
be either True or False. However, I can't find any other code that might
need my forms to have this property set! I have no recollection of how or
why they are there, and, yes, there is not documentation thanks to the lazy
slob who wrote the code. <g>

Does this usage look familiar to anyone? I've commented it out and
everything *seems* ok, but...

Thanks!
Fred Boer



Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

Me.Tag = -1

DoCmd.Maximize


Exit_Form_Open:
Exit Sub

Err_Form_Open:
fncWRMSErrMsg err.Number, err.Description
Resume Exit_Form_Open

End Sub


Private Sub cboPatronFullName_AfterUpdate()
On Error GoTo Errorhandler

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Fullname] = '" & Me![cboPatronFullname] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.cboPatronFullname = Null

Me.Tag = 0

If Me.txtPatronType_ID <> 0 Then
Me.txtStaffFullname.Visible = False
Else
Me.txtStaffFullname.Visible = True
End If

Exitpoint:
Exit Sub
Errorhandler:
fncWRMSErrMsg err.Number, err.Description
Resume Exitpoint


End Sub
 
V

Van T. Dinh

It is slightly wrong, actually. The Tag Property is a String property so it
cannot store True or False.

Search your codes (current project scope) for "Tag" and you should find
where you assigned the values and where you used these values (unless the
codes have been changed and you no longer used the Tag values)
 
F

Fred Boer

It is slightly wrong, actually.

Well, there's no doubt I wrote it then! <g> I looked and can find no other
instances in my current code, so I must have tried to implement something
and dropped or deleted it later. Thanks!

Fred
 
V

Van T. Dinh

It sounds like you can safely delete these assignments.

--
Cheers
Van T. Dinh
MVP (Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top