Hi Steve, I think the form's name is CO_pakiranje_SD14 and Form_ is there to reference the open instance (should really be Me. as the code is running in that form's module).
https://www.tek-tips.com/viewthread.cfm?qid=1785126
Cheers,
VladSeems that you missed my mention in this post:Hi Vlad,
Somewhere (I lost the reference - a couple of HHD crashes ago ), I read it was not a good/accepted way of referencing a form object.
The article link you posted seems to lean toward not using "FORM_" nomenclature. And the only place I've see "Form_" is in the IDE.
But I am going to study this more.....
Thanks for the link.
Steve
The class is like a drawing of a building and an instance is like a building. Setting a value to the class at runtime, it is like sending a letter to the drawing, not to the building.Form_CO_pakiranje_SD14 is the class of then form "CO_pakiranje_SD14", not the running instance of this class and, in this case of reference, code works accidentally. You have to use a proper way of reference to a loaded form, like:
- Me (for the “potpis” form)
- Forms("CO_pakiranje_SD14")
- Forms!CO_pakiranje_SD14
Check out the relevant sample in attachment.
- Try to edit "My Form Class" before open it, then, open it and try again to edit. Seems that the refenece to the loaded form has lost.
- Open all forms in several sequence, choose "My Form Class" and then close them by clicking the "Close" button of the frame. Seems that the Form_MyForm refers to the instances in a FIFO order or by chance.
Cheers,
John
Edit:
A relevant thread: https://www.accessforums.net/showthread.php?t=82012
Hi John,
Thank you very much for the info and sample, I did read your original post and I agrred with it; I usually use Me. or Forms!
@Santon
Have you tried to use Me.potpis_operater=Null?
If you make it ="" you will need to change the way you check for empty values in the future for that field, as you will have a mixture of "" and Nulls (for the new records that do not have the value entered yet). So instead of IsNull([potpis_operater])=True you will have to use Nz([potpis_operater],"")="" to identify empty" records.
Cheers,
Thank you guys for your advices and your time.
I'm sry I'm just a newbie in VBA and access so it is inevitable that I make mistakes.
Would this be the correct way? I've changed all the highlighted code with the one on the right and it works.
I have also changed the names of the controls so it is not the same as it was before control source (field in table) operater_p and control name operater_p
Also, operater_p_combo is the combo box in form for selecting employees, and potpis_operater_box is the textbox for entering the pin number
Is this okay?
Looking good ! ANd no worries about making mistakes, we all (still) do them once in a while...
Cheers,
Vlad