Results 1 to 3 of 3
  1. #1
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194

    use text value when form is dirty...

    Hi people,

    Hopefully i used the correct terminology!



    I ahve a textbox [Name] that i have a keypress down event on (enter key = 13)
    This event brings up a form based on forms!People![Name]

    Issue:
    It is using whatever was in [Name] before i started typing.

    eg. if "adam" was in [name] even if i delete adam and type "Frank", when i press enter, the new form is still looking at "adam" as the text "frank" hasnt been 'saved' to the form as im still IN the text box...

    Ideas?
    Is it just a matter of "if press enter - change focus to next tab point then run the event" or is there another way?

  2. #2
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    When you are referring to Forms!People![Name], you are really saying Forms!People![Name].Value, but you don't need to add the Value keyword because that is implied. However, if you want to get the current text of the textbox even while you are still editing it, you can use the Text keyword. I suggest that you adopt a naming convention when you refer to controls in your form. Using Name as a field name can cause problems because it is a reserved word. For textboxes, you can use the prefix txt in its name so in this case, it should be called txtName. You can use cbo (or cbx) for combo boxes, lst (or lbx) for listboxes, and so on.

    So to see the text "adam", you would use Forms!People!txtName.Text

    Ron

  3. #3
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    THAnks!

    That solved it
    I actually am using better fields and correct naaming, similar to what you suggested, the above was just an example to concentrate on the issue, not for you to have to learn all my box names etc But thanks for pointing it out anyway.

    I do use txtName etc etc



    Thanks for the .text answer, it sorted my problem out

    Another thing learnt!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Dirty property for Text Box
    By tylerg11 in forum Forms
    Replies: 6
    Last Post: 04-07-2015, 11:02 AM
  2. Dirty event not activating on Access 2007 form
    By newbieX in forum Programming
    Replies: 4
    Last Post: 06-17-2014, 12:57 PM
  3. Replies: 6
    Last Post: 12-23-2013, 07:38 PM
  4. Replies: 1
    Last Post: 12-12-2011, 01:58 PM
  5. On Dirty fires but Me.Dirty = False (v2010)
    By Rod in forum Programming
    Replies: 5
    Last Post: 07-30-2011, 08:42 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