Results 1 to 12 of 12
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data Mode Argument Question (2000)

    Hi,
    I have a database that basically tracks hours employees have worked on specific machines. I have a form that uses a combo box to Find the employee and then a subform that contains the machine and hour information, they put in the date worked, hours, and pick the machine. This has been working great, once they choose the employee from the drop down list, the subform is in Data Entry mode.

    Now all of a sudden, and I don't know what changed. I was working on another query, but can't see how I could have affected this form. But now, once I pick the employee from my list, is seems to take the subform out of Data Entry mode and it shows every entry for that employe and I can't for the life of me figure out what is wrong. I did find in help "If Data Mode argument of Open Form is set to Edit, then Access will use Data Entry - No". My problem is I don't know where or what Data Mode argument is. Can anyone help?

    Thanks,
    Deb Buck

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Mode Argument Question (2000)

    I don't know if this will help you with your problem. DataMode is one of the arguments of the OpenForm method of the DoCmd object. This method is used to open a form in Visual Basic code.

    You can set the Allow Edits, Allow Additions and Data Entry properties of a form in the Properties window. You can also specify these (more or less) when you open a form in code. The DataMode argument can have the following values:

    acFormEdit - users can edit existing records and add new records
    acFormAdd - users can only add new records
    acFormReadOnly - users can only view existing records
    acFormPropertySettings - use the settings from the Properties window (this is the default behavior)

    If you use acFormEdit, acFormAdd or acFormReadOnly, this will overrule the settings in the Properties window.

  3. #3
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Mode Argument Question (2000)

    Thank you for responding Hans, it does help with the definition. Can you supply help as to where I would look for this? I've checked everywhere I know how. I can't find anything in the code section (but not that familiar with code), I've checked the forms properties and there's nothing there either. When I first open the form, Data Entry=Yes is on because it only shows a blank record and the AddNew Record button is grayed out. It only seems to happen once I select a name from my combo box.

    Still confused,
    Deb

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Mode Argument Question (2000)

    It's certainly not standard behavior. In a small test I did, the subform stayed in data entry mode after using the combo box to locate a record on the main form.

    Can you post the code behind the combo box? You must have an AfterUpdate event for the combo box.

  5. #5
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Mode Argument Question (2000)

    Hi Hans,
    The test you did is exactly how it's supposed to work and that's how it used to work. I don't know what I've changed to make it not. I think something is overriding something else. Here's the code that comesup when I'm in the form and say show code:
    Option Compare Database

    Private Sub Combo12_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[lngEmpID] = " & Str(Me![Combo12])
    Me.Bookmark = rs.Bookmark
    End Sub

    Private Sub Command15_Click()
    On Error GoTo Err_Command15_Click

    Dim stDocName As String

    stDocName = "mcrCloseOpenGroup.mcrCloseTaleEmp"
    DoCmd.RunMacro stDocName

    Exit_Command15_Click:
    Exit Sub

    Err_Command15_Click:
    MsgBox Err.Description
    Resume Exit_Command15_Click

    End Sub

    Thanks,
    Deb

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Mode Argument Question (2000)

    The AfterUpdate event handler for the combo box is, as I expected, "standard" search code; it doesn't cause the behavior you describe. I fear that it isn't possible to find out what *is* causing it from a distance.

    I don't know how important it is for you to solve this problem. If you wish, you can give other Loungers a chance to examine the problem:

    <UL><LI>Make a copy of the database and work with that.
    <LI>Remove all database objects that are not relevant to the problem.
    <LI>In the remaining table(s), remove most records - leave only the minimum number necessary to demonstrate the problem.
    <LI>Remove or modify data of a confidential nature.
    <LI>Do a compact and repair (Tools/Database Utilities).
    <LI>Make a zip file containing the database; it should be below 100KB.
    <LI>Attach the zip file to a reply.[/list]

  7. #7
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Mode Argument Question (2000)

    I've checked all the items suggested, but still can fix it. I've attached the database. The form is "frmTaleBookEntrybyEmployee" and there's a subform "sfrmDateWorkedHoursEmpWorkedSubform". The are both based on table. Once again, this was working fine for several months and I have no idea what I did to change it.

    Please help.
    Thanks,
    Deb
    Attached Files Attached Files

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Mode Argument Question (2000)

    I'll have a look at it later today. Perhaps someone else has time now...

  9. #9
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Data Mode Argument Question (2000)

    I certainly had no problem selecting a record from the combobox. The subform showed the records as well as the one it wants to add. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Mode Argument Question (2000)

    There is some kind of invisible and non-essential but irritating change (corruption?) in your tables. The behavior you describe occurs not only if you select a name from the combo box, but also when you move to another record in the main form.

    In one of my test databases, I created a similar situation, and got the desired behavior (the subform stayed in data entry mode). I imported your tables into the test database, and reconstructed the form and subform, and saw the problem behavior. I then created new tables; I copied and pasted the fields from your tables into them in design view, and after that, I copied and pasted the records from your tables into them in datasheet view. Then I created the form and subfom, and got "correct" behavior. Apparently, the behavior is inherited by the forms, for switching the record source of the original forms to the "new" tables doesn't help.

    I have looked at the table properties, but I can't find a difference between the original tables and my almost-copies. I have attached a zipped database with the "new" tables and forms.
    Attached Files Attached Files

  11. #11
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Mode Argument Question (2000)

    Pat,
    The problem is the subform is supposed to be in Data Entry mode, so it should be blank once a selection from the combo box is made.

    Thanks,
    Deb

  12. #12
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Mode Argument Question (2000)

    Thanks for checking this out Hans. I tried everything you tried, with the exception of copying and pasting the fields and data into a new table. I'll give that a shot and see what happens.

    Thanks a ton.
    Deb <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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