Deleting data in form Tag (VBA)

ITguy1981

Registered User.
Local time
Today, 04:54
Joined
Aug 24, 2011
Messages
137
Have some information in the tag property of a form that I would like to change by using code or delete by using code. I'm not sure what the syntax would be to delete and reference the tag in visual basic. I originally used DoCmd.DeleteObject ([Forms]![FormName].Tag), but I don't think that is right.
 
Do you want this to be a permanent change or just temporary? To be permanent you would need to have the code open the form in DESIGN VIEW and then make the change and then save the form. For a permanent change you should be able to just use:

Forms!FormNameHere.Tag = "New Tag Info"

or to clear it

Forms!FormNameHere.Tag = vbNullString
 
Thank you very much. One more question. Do I need a DoCmd. and what would be after the DoCmd.?
 
Thank you very much. One more question. Do I need a DoCmd. and what would be after the DoCmd.?

Not sure what your question means. What about a DoCmd? If you answer my questions perhaps that would shed light on this question.
 
Sorry about not answering your question. I want the tag data to be erased/deleted. The change will be permanent. Basically, I have code that checks some data I put in a tag of a form. If the criteria of my code is true I would like for it to delete the data from the tag permanently. When I asked about the docmd. I was wondering if I had to put in something like DoCmd.???? Forms!FormName.Tag = vbNullString or just Forms!FormName.Tag = vbNullString
 
With the questions answered I can now give you the code:

Code:
DoCmd.OpenForm "FormNameHere", acDesign, WindowMode:=acHidden
Forms!FormNameHere.Tag = vbNullString
DoCmd.Close acForm, "FormNameHere", acSaveYes
 

Users who are viewing this thread

Back
Top Bottom