Results 1 to 6 of 6
  1. #1
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26

    Add New Button

    Is there any reason this wouldn't work?



    Code:
    Private Sub Command106_Click()
    If Me.FilterOn = True Then
    Me.FilterOn = False
    DoCmd.GoToRecord , , acNewRec
    End If
    If Me.strEmp.Value = Null Then
    Me.strEmp.Locked = False
    Me.strEmp.Value = [Forms]![yp_ipm]![current_user]
    Me.strEmp.Locked = True
    End If
    End Sub
    It adds a new record but is not entering a value in the proper field.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You can't test for Null like that. Try the IsNull() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26
    That returned a compile error

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What exactly returned a compile error? Did you try


    If IsNull(Me.strEmp.Value) Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26
    Worked like a charm, I was just being a dunce. Thank you.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 0
    Last Post: 01-11-2012, 12:34 PM
  2. Replies: 10
    Last Post: 03-21-2011, 02:46 PM
  3. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  4. Replies: 6
    Last Post: 02-09-2010, 07:53 AM

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