Cannot set opening form tag

D

Dave

Even after researching this, I can't find anything that gives me a
clue as to why this doesn't work:

DoCmd.OpenForm "frmNP"
With Forms("frmNP")
.Tag = "edit"
.RecordSource = "tempNPhdr"
.Filter = "[NPno]='" & Me!lstNPno & "'"
End With

The opened form's recordsource and filter are correctly set, but I
can't seem to affect the tag property. A debug statement before the
End With shows the value has been assigned to Tag, but if I flip the
opened form to design view, the tag has no value. I checked this
because code based on the tag behind the opened form did not run. Can
the tag value only be set on the opening form's load event or
something?
Thanks.
 
D

Douglas J. Steele

I'm not surprised that it doesn't show up when you switch to Design mode,
because you haven't saved the change.

Try going to the Immediate Window (Ctrl-G), typing ?Forms!frmNP.Tag and
hitting Enter while the form's open.
 
D

Dave

I'm not surprised that it doesn't show up when you switch to Design mode,
because you haven't saved the change.

Try going to the Immediate Window (Ctrl-G), typing ?Forms!frmNP.Tag and
hitting Enter while the form's open.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




Even after researching this, I can't find anything that gives me a
clue as to why this doesn't work:
DoCmd.OpenForm "frmNP"
   With Forms("frmNP")
   .Tag = "edit"
   .RecordSource = "tempNPhdr"
   .Filter = "[NPno]='" & Me!lstNPno & "'"
End With
The opened form's recordsource and filter are correctly set, but I
can't seem to affect the tag property. A debug statement before the
End With shows the value has been assigned to Tag, but if I flip the
opened form to design view, the tag has no value. I checked this
because code based on the tag behind the opened form did not run. Can
the tag value only  be set on the opening form's load event or
something?
Thanks.- Hide quoted text -

- Show quoted text -

Not sure what happened to my 1st reply attempt. I tried your
suggestion and found it to be the same as the debug statement I
referred to. Recall also that even when I didn't switch views, the
code based on the form tag didn't run, as though it had not been set.
I'll try saving the form after the End With and hope it has no effect
on the opened form's underlying record. If you have a better
suggestion, I'd appreciate that. Thanks.
 
D

Douglas J. Steele

Perhaps the problem isn't with the tag not being set, but with your code
that relies on the value of the tag.

What's it look like?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I'm not surprised that it doesn't show up when you switch to Design mode,
because you haven't saved the change.

Try going to the Immediate Window (Ctrl-G), typing ?Forms!frmNP.Tag and
hitting Enter while the form's open.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




Even after researching this, I can't find anything that gives me a
clue as to why this doesn't work:
DoCmd.OpenForm "frmNP"
With Forms("frmNP")
.Tag = "edit"
.RecordSource = "tempNPhdr"
.Filter = "[NPno]='" & Me!lstNPno & "'"
End With
The opened form's recordsource and filter are correctly set, but I
can't seem to affect the tag property. A debug statement before the
End With shows the value has been assigned to Tag, but if I flip the
opened form to design view, the tag has no value. I checked this
because code based on the tag behind the opened form did not run. Can
the tag value only be set on the opening form's load event or
something?
Thanks.- Hide quoted text -

- Show quoted text -

Not sure what happened to my 1st reply attempt. I tried your
suggestion and found it to be the same as the debug statement I
referred to. Recall also that even when I didn't switch views, the
code based on the form tag didn't run, as though it had not been set.
I'll try saving the form after the End With and hope it has no effect
on the opened form's underlying record. If you have a better
suggestion, I'd appreciate that. Thanks.
 

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