Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

    When you set the DataEntry property to YES the form will *only* display new records. Set it to NO and see what happens.

  2. #17
    lloyddobler is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    19
    If I only have 2 fields, I'll need them both bound in order to do my insert. If I change it to data entry=no, then when I open the form it displays a record, which I don't want, I want a blank form when opened, and when a control# is keyed in, if it exists, it populates the comments and allows for said comments to be edited. If the control number does not already exist, then a new record should be added.

  3. #18
    lloyddobler is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    19
    Okay, got it working now. I've kept the Dlookup, and for the ONCLICK event for SAVE command button, I've added the following code:

    Code:
     
    Private Sub cmdSaveRecord_Click()
    If DCount("controlnumber", "tbl_Claim_Overview", "[controlnumber] = '" & Me.[Control Number] & "'") > 0 Then
    DoCmd.SetWarnings False
    Dim string1 As String
    
    string1 = "UPDATE tbl_Claim_Overview" & _
      "  Set MyTable.claimoverview = '" & Forms![MYFORM]![ClaimOverview] & _
      "' WHERE MyTable.[controlnumber] = '" & Forms![MYFORM]![Control Number] & "'"
      
    Debug.Print string1
    DoCmd.RunSQL string1
      
      Else
      
    DoCmd.RunSQL "INSERT INTO MyTable (controlnumber, claimoverview)" & _
      " VALUES(forms![MyFORM]![control number],forms![MYFORM]![claimoverview])"
    End If
    DoCmd.SetWarnings True

  4. #19
    csako1 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    3
    good day! just want to ask if this is possible in single execution???

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. SQL - find out whether a table exists
    By yurako in forum Programming
    Replies: 2
    Last Post: 01-20-2010, 09:27 AM
  2. How to use if not exists in access?
    By halifaxdalRaymondXie in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:18 PM
  3. Replies: 1
    Last Post: 11-30-2009, 05:05 AM
  4. help with insert
    By jamie in forum Access
    Replies: 1
    Last Post: 11-16-2009, 06:02 AM
  5. Create Table If Not Exists
    By jp2access in forum Queries
    Replies: 7
    Last Post: 07-14-2009, 12:49 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