Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2004
    Location
    Arizona
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post

    Setting the Form.DataEntry mode in code not taking effect

    I have a subform setup so that when you double click a record selector it opens a form displaying information on that record.

    My issue is that when I set the Form.DataEntry within the forms' properties window it *acts* like it had no effect. I say it acts like it doesn't because the Msgbox indicates the setting was changed, but the wrong record opens. In fact, regardless on which record you double click the same one opens, which is the first in the record set. Once I comment out the DataEntry code line it works as long as within the forms' properties window it is set to False. Form.AllowAdditions setting appears to work fine in code.

    'Forms![frmRMA_Repair].Form.DataEntry = False ' THIS SETTING DOES NOT WORK IN CODE
    'MsgBox Forms![frmRMA_Repair].Form.DataEntry
    Forms![frmRMA_Repair].Form.AllowAdditions = False

    I'm setting this in code because this window is called from other places in the project. Sometimes it's only to add and other times it's to open a specific existing record.
    Dell Precision Mobile Workstation M6500, Intel Core i7-940XM Extreme Edition, 2.13GHz, 8MB cache, 16GB RAM, 500GB HD, 1GB NVIDIA Quadro FX 3800M graphics
    Windows 7 Pro 64-bit, Office 2010 64-bit
    www.CaptainKen.us

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Where does this code execute? Is this part of the double click event that opens the form to show a record?
    If so can you show us the full event.

    Normally the form frmRMA_Repair has its data entry property set to True. Is that right?

    I think I would permanently change the data entry property to false.
    When I want to use the form to add a new record use:
    Docmd.Openform stDocname,,,,acFormAdd

    added later

    You can also use
    Docmd.Openform stDocname,,,,acFormEdit
    to convert a Data entry from to one that allows editing of records.
    You would still need to set allow additions to false
    The code I would use for that would be
    Forms(stDocname).AllowAdditions=False

    This all assumes you have a string variable stDocname and you have set it to the name of the form.
    Last edited by johnhutchison; 2012-02-28 at 01:22.
    Regards
    John



  3. The Following User Says Thank You to johnhutchison For This Useful Post:

    CaptainKen (2012-03-04)

  4. #3
    Lounger
    Join Date
    Mar 2004
    Location
    Arizona
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Hello John. Not sure why but I never got an email indicating that anyone replied, so I never checked back until I got the urge today.

    Yes it's a double click on the sub form that open the RMA form.

    I wasn't aware of the acFormAdd and acFormEdit. Looks like you have better more standard and specific way to do it. I'll give it a try.

    Strange about the failed attempt at setting the DataEntry mode in code. Wanted to do it in case I accidentally changed it in properties at a future date. I like hard coding settings that have a major effect on how a process works, to be safe. Plus its' a nice and easy to see what's going on by just viewing the code and not hopping back and forth.

    Thank you!

    Ken
    Dell Precision Mobile Workstation M6500, Intel Core i7-940XM Extreme Edition, 2.13GHz, 8MB cache, 16GB RAM, 500GB HD, 1GB NVIDIA Quadro FX 3800M graphics
    Windows 7 Pro 64-bit, Office 2010 64-bit
    www.CaptainKen.us

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •