Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    That is where the Delete command we commented out comes in to play. So we want to uncomment it.



    I was playing around with it, and this order seems to have the nicest results:
    Code:
    Private Sub Command18_Click()
    
    '   Add new record
        Me.Refresh
        DoCmd.SetWarnings False
        DoCmd.OpenQuery "TempCustQuery", acViewNormal, acEdit
        MsgBox (Me.TempCustName & " has been entered as a new company.")
    
    '   Then delete it from the temp table and form
        DoCmd.RunSQL "Delete [tblTemporaryCustomer].* From [tblTemporaryCustomer];"
        Me.Requery
        DoCmd.SetWarnings True
        
    
    End Sub
    Without the "Requery" line, all the fields would show as "#DELETED" on the Form.

  2. #17
    dylcon is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Ann Arbor
    Posts
    130
    The only existing problem with this is:
    If a user enters a company name, hits tab, then closes the form, upon opening it again, it will show "#DELETED". Should I just add a requery line in the event of opening the form?

  3. #18
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If a user enters a company name, hits tab, then closes the form, upon opening it again, it will show "#DELETED". Should I just add a requery line in the event of opening the form?
    One way to find out, give it a try and see if it works (programming is a lot of "trial and error"!).

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

Similar Threads

  1. Command button
    By jiawen in forum Access
    Replies: 3
    Last Post: 01-12-2013, 12:07 PM
  2. Button Command
    By JayX in forum Access
    Replies: 2
    Last Post: 12-15-2011, 12:33 PM
  3. Command Button
    By tia in forum Access
    Replies: 1
    Last Post: 11-20-2011, 11:47 AM
  4. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  5. Command Button Help!
    By arthura in forum Programming
    Replies: 3
    Last Post: 06-30-2009, 12:55 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