form creates a record on opening

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Knowlton
    New Member
    • Feb 2011
    • 75

    #1

    form creates a record on opening

    I have a form that has a single table as it's control source. Upon opening to a new record the PrimaryKey field(Autonumbe r) populates without having entered any data. I have the following code in the form's OnLoad event.
    Code:
    If Not Me.NewRecord Then
            DoCmd.GoToRecord , , acNewRec
        End If
    I've checked all controls for a default value and none have any. There are also no default values defined in the table.
    What could be causing this?
    Thanks
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    Default values wouldn't create a new record. You would need to look in all of the form's events (Open, Load, Resize, etc.) for a macro or VBA procedure. You must have some code/macro that is editing the value in a field somewhere.

    Comment

    • Knowlton
      New Member
      • Feb 2011
      • 75

      #3
      You are right. I had code to clear unbound controls in a new record. I commented them out and that corrected the problem.
      Thanks

      Comment

      Working...