Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35
  1. #31
    santon's Avatar
    santon is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2020
    Posts
    44


    Quote Originally Posted by Gicu View Post
    Can you please try:

    Me.potpis_operater=Null

    Cheers,
    I've changed this Null back into empty string "" and it worked without showing no error.
    Click image for larger version. 

Name:	Untitled (1).jpg 
Views:	14 
Size:	41.0 KB 
ID:	43678
    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	27.5 KB 
ID:	43679


    Is that okay? will there be problems in the future? because at the beginning of this post you guys corrected this part into "Null".

  2. #32
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by Gicu View Post
    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,
    Vlad
    Quote Originally Posted by ssanfu View 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
    Seems that you missed my mention in this post:
    Quote Originally Posted by accesstos View Post
    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
    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.

    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
    Attached Files Attached Files

  3. #33
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,125
    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,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #34
    santon's Avatar
    santon is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2020
    Posts
    44
    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?

    Click image for larger version. 

Name:	tempsnip.jpg 
Views:	9 
Size:	58.3 KB 
ID:	43687

  5. #35
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,125
    Looking good ! ANd no worries about making mistakes, we all (still) do them once in a while...

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Employees Example
    By Mickjav in forum Code Repository
    Replies: 1
    Last Post: 07-06-2020, 12:35 PM
  2. Replies: 11
    Last Post: 04-03-2020, 10:36 PM
  3. How to assign employees
    By rjayb118 in forum Access
    Replies: 5
    Last Post: 09-26-2016, 05:19 PM
  4. Replies: 1
    Last Post: 01-31-2014, 11:03 PM
  5. Replies: 1
    Last Post: 08-23-2013, 07:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums