p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: Dirty Record Property


Message #1 by PStreeter@C... on Thu, 13 Jun 2002 15:41:36 CST
I have a situation where the user of my application may 
add a record to o table through a form I hav provided, then 
open a form and add a record to another table that requires 
the first record for referential integrity. There was a problem 
because the first record was still only on the form, not saved 
to the table. No problem; I just added "DoCmd.RunCommand
 acCmdSaveRecord " to the procedure for the button that 
opens the new form. Now, if the record is not new or at least 
modified, I get the message that the save command is not 
available. Is there a property that tells whether a record 
needs to be saved? (At 4:38 pm I also wonder if it should be 
baptized and perhaps given communion.) 

Paul


Message #2 by Patrick_Slesicki@d... on Thu, 13 Jun 2002 15:37:54 -0700
Try using something like this

Private Sub Form_BeforeUpdate(Cancel As Integer)
     if me.dirty then
          "your code here," e.g. docmd.save
     end if
End Sub



                                                                                                                         
                    PStreeter@C...                                                                                 
                              .Mensa.Org       To:     "Access" <access@p...>                                    
                                               cc:                                                                       
                       06/13/02 02:41 PM       Subject:     [access] Dirty Record Property                               
                       Please respond to                                                                                 
                                "Access"                                                                                 
                                                                                                                         
                                                                                                                         




I have a situation where the user of my application may
add a record to o table through a form I hav provided, then
open a form and add a record to another table that requires
the first record for referential integrity. There was a problem
because the first record was still only on the form, not saved
to the table. No problem; I just added "DoCmd.RunCommand
 acCmdSaveRecord " to the procedure for the button that
opens the new form. Now, if the record is not new or at least
modified, I get the message that the save command is not
available. Is there a property that tells whether a record
needs to be saved? (At 4:38 pm I also wonder if it should be
baptized and perhaps given communion.)

Paul






Message #3 by Paul Streeter <PStreeter@C...> on Thu, 13 Jun 2002 20:23:07 -0500
Thanks, I thought that "dirty" was involved, but didn't quite remember.
Paul

Patrick_Slesicki@d... wrote:
> Try using something like this
> 
> Private Sub Form_BeforeUpdate(Cancel As Integer)
>      if me.dirty then
>           "your code here," e.g. docmd.save
>      end if
> End Sub
> 



  Return to Index